![]() |
Excel function to reverse the order of rows in a spreadsheet
Does anyone know a function to reverse the order of rows in a spreadsheet?
E.g. if I have n active rows I want to swap rows 1 and n, 2 and n-1, 3 and n-2 etc. |
Excel function to reverse the order of rows in a spreadsheet
Set up a helper column and number your rows (1, 2, n) then sort your table
using this helper column in descending order. or if your data is in B1:B10, you could use =INDEX(B$1:B$10,ROWS(B1:B$10)) and copy it down "Peter-OL" wrote: Does anyone know a function to reverse the order of rows in a spreadsheet? E.g. if I have n active rows I want to swap rows 1 and n, 2 and n-1, 3 and n-2 etc. |
Excel function to reverse the order of rows in a spreadsheet
Hmm, thanks, JMB. I didn't think of a helper column.
I was assuming that since there's such a plethora of clever and elaborate functions in Excel there must be a simple one to do this. However the helper column will do the job. "JMB" wrote: Set up a helper column and number your rows (1, 2, n) then sort your table using this helper column in descending order. or if your data is in B1:B10, you could use =INDEX(B$1:B$10,ROWS(B1:B$10)) and copy it down "Peter-OL" wrote: Does anyone know a function to reverse the order of rows in a spreadsheet? E.g. if I have n active rows I want to swap rows 1 and n, 2 and n-1, 3 and n-2 etc. |
Excel function to reverse the order of rows in a spreadsheet
You're welcome
"Peter-OL" wrote: Hmm, thanks, JMB. I didn't think of a helper column. I was assuming that since there's such a plethora of clever and elaborate functions in Excel there must be a simple one to do this. However the helper column will do the job. "JMB" wrote: Set up a helper column and number your rows (1, 2, n) then sort your table using this helper column in descending order. or if your data is in B1:B10, you could use =INDEX(B$1:B$10,ROWS(B1:B$10)) and copy it down "Peter-OL" wrote: Does anyone know a function to reverse the order of rows in a spreadsheet? E.g. if I have n active rows I want to swap rows 1 and n, 2 and n-1, 3 and n-2 etc. |
All times are GMT +1. The time now is 04:48 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com