56 free macros indexedAll toolsHow to runBlogGitHub ↗

Reverse Row Order

Flip the order of rows in your selection top-to-bottom in place, keeping all columns aligned

windows · mac · Excel 2016+ · Free


What it does

You want the bottom row at the top and vice versa. Excel has no "reverse rows" command. The standard workaround is to add a helper column with =ROW(), sort descending by it, then delete the helper, which is three steps and one place to mess up. The macro reverses the row order in place using a single Variant-array swap. Every column in your selection moves together so rows stay aligned. Run it once: top becomes bottom, bottom becomes top.

Real-world example

Picture a portfolio manager at a registered investment advisor in Seattle reviewing a client's 12-month transaction history before a quarterly meeting. The brokerage exports the transactions sorted oldest-first. He prefers reading newest-first because the recent activity is what the client always asks about. Sorting by date works most of the time, but this client has a few same-day transactions where the order matters and the brokerage's ordering captures a sequence the date-sort would lose.

His current workaround: insert a helper column at column A, drop =ROW() in row 2, fill down 480 rows, sort the data descending by that helper, then delete the helper column. About 2 minutes per client review. He does six client reviews per quarter, so it adds up to a small annoyance with low stakes but high frequency.

With this macro he selects rows 2 through 481, runs the tool, and the row order flips in about half a second. The popup confirms 480 rows were reversed. Same-day transactions stay in their original sequence because the macro reverses without touching individual values; it just moves rows. Total elapsed: 5 seconds.

On a typical 480-row client transaction review, expect about 2 minutes saved per pass. Across 24 client reviews per year that's about 50 minutes back. The bigger win is preserving the original same-day sequence that a date-sort would scramble.

How to use

First time? See How to run our tools for the 30-second setup.

  1. Select the rows you want to reverse. Include every column the rows span; the macro reverses them as units.
  2. Press Alt + F8 (Windows) or Option + F8 (Mac), pick ReverseRowOrder, click Run.
  3. The macro flips the rows in place. The popup confirms how many rows were reversed.

FAQ

Does it work on a wide selection with many columns?

Yes. The macro reads the entire selection into a Variant array, builds a reversed copy, and writes it back. Rows stay aligned no matter how wide the selection is. So a 1,000-row by 30-column block reverses just as cleanly as a 1,000-row by 1-column block.

Will it preserve formulas?

Formulas are preserved as text values during the reversal. So a formula like =A2+B2 in row 5 ends up in row 1 still as =A2+B2, which now references different cells than before. If your data has formulas with relative references, the result after reversal may not be what you want. Convert formulas to values first with Convert Formulas to Values if you need the reversed view to keep its calculated results.

Can I include the header row?

You can, but it'll move to the bottom along with everything else. Most of the time you'll select rows 2 through the last data row and leave the header in place. If you accidentally include the header, undo with Ctrl+Z, narrow your selection, and rerun.

Does it handle merged cells?

Not gracefully. Merged cells in the selection cause Excel to either error or produce strange results because the Variant-array assignment doesn't preserve merge boundaries. Run Unmerge Cells and Fill Down first to flatten any merged cells, then reverse the row order safely.

Can I undo it?

Yes, Ctrl/Cmd + Z right after running undoes the reversal in one step. Always work on a copy of the file if it's the only copy. The macro runs entirely offline. Your data never leaves your machine.

Did this tool work for you?

One click. We use this to fix tools that don't work and prioritize what to build next.

Related tools