Forum Discussion
Mmrtlm
Jul 12, 2023Copper Contributor
Sort Column according to another column with blank rows in between
Hey there, I‘m struggling with a table I‘d like to create, without killing myself using copy paste for hours. I‘ve got the following data: - every X minutes 11 parts have to be delivered - ...
NikolinoDE
Jul 13, 2023Platinum Contributor
To sort the columns in Excel according to the time column while keeping the blank rows in between, you can use a combination of sorting and formula-based approaches. Here's a step-by-step guide:
- Create a new column next to your existing data. Let's call it "Sort Helper."
- In the Sort Helper column, enter the formula =IF(A2<>"",ROW(),"") assuming your time column is in column A. This formula assigns a unique number to each non-blank cell in the time column, and blanks will be assigned an empty string.
- Drag the formula down to cover all the rows with data.
- Select the entire table, including the Sort Helper column.
- Go to the "Data" tab in the Excel ribbon and click on "Sort."
- In the Sort dialog box, select the Sort Helper column as the sort column and choose "Values" as the sort type.
- Click "OK" to apply the sort. This will rearrange the table based on the time column while keeping the blank rows intact.
- You can remove the Sort Helper column if desired.
This method leverages a helper column to assign unique numbers to non-blank cells, allowing you to sort the table based on this helper column. The blank rows will retain their position in the sorted table.
Note: If you have formulas or references in other columns that are affected by the sorting, make sure to adjust them accordingly to maintain their intended behavior after sorting. The text and the steps are the result of various AI's put together.
My answers are voluntary and without guarantee!
I hope this helps!