How to Sort Data but Keep Blank Cells in Excel

In daily work, if we sort data with blank cells included in the same column, these blank cells are listed at the bottom automatically after sorting. If we want to keep the positions of these blank cells unchanged and only sort the others, how can we do that? In this article, we will show you the way to sort data in this scenario.

EXAMPLE

          ->         

There are two blank rows listed in above table. We want to sort data by score column with the two blank rows locked in row 5 and row 9. Normally, if we select score column and directly click sort “Z to A” button to sort data, the two blank cells are listed at the bottom, this behavior is not our expectation.

In fact, if we want to sort data with blank cells locked in their own positions, we can hide them firstly, then sort data in visible cells. After sorting data by proper order, we can unhide the hidden rows, the blank cells are still listed there.

STEPS

a. Select range A2:B13, then click Home in the ribbon, in Editing section click Find & Select button to see options for finding texts in document.

b. Click Go To Special option.

c. In Go To Special dialog, check on “Blanks” option. Options in this dialog are exclusive. Then click OK button.

d. After clicking OK, all blank cells are highlighted.

e. Keep blank cells highlighted. Press Ctrl+9 to hide rows. In Excel, Ctrl+9 can hide rows with cell or range highlighted. If you want to unhide rows, you can press Ctrl+Shift+9. If you want to hide columns instead of rows, you can press hotkey Ctrl+0.

f. Now, select B2:B13 with blank rows hidden, click Data in the ribbon, click Sort Largest to Smallest button in Sort & Filter section to sort numbers in B2:B13 from the largest to smallest.

g. After sorting, numbers are sorted from the largest to smallest properly.

h. Select entire rows from row 2 to row 13, right click to load row editing menu, click Unhide.

Blank cells (rows) are still listed there.

 

Related Posts

Filter Data by Column and Sort by Row
filter by column sort by row1

This post will guide you how to use the FILTER function to filter a value by column and then sort data by row in Microsoft Excel. You can use the following formula based on the SORT function in combination with ...

Filter And Transpose Data From Horizontal To Vertical
filter and transpose horizontal to vertical1

This post will show you how to use Filter function and in combination with Transpose function to filter data from horizontal and transpose data as vertical in Microsoft Excel. You can refer to the below general formula based on TRANSPOSE ...

VLOOKUP Formula | Faster Trick with 2 VLOOKUPS
Faster VLOOKUP with 2 VLOOKUPS1

This post will guide you how to use 2 VLOOKUPS function to looking up data entries from a given range of cells in Microsoft Excel. VLOOKUP with 2 lookups can be faster than a single VLOOKUP in certain scenarios. The ...

Extract Unique Items From A List
Extract Unique Items From A List In Excel1

This post will guide you how to extract unique itmes from a given list in Microsoft Excel. How to create a newly formula to get unique values from a range cells in Excel. The unique list of items is the ...

Extract substring In Excel
Extract substring In Excel1

This post will guide you how to use Excel's MID function is a quick and easy way to extract pieces from your text. Use the Excel formula to extract a substring with MID. Note: If you want to extract just ...

How to Use 3D SUM Multiple Worksheets
3D sum multiple worksheets1

To sum a range of numbers is straightforward for most Excel users, but do you know how to establish a 3D reference to total the same range of numerous sheets. In this post, I will present the steps for this ...

Extract all the matches with helper Column
how to extract all matches with helper column1

With Excel's powerful functions IF, INDEX, and MATCH, we can find exactly what you're looking for with a few clicks of the mouse. This step-by-step tutorial will show how easy it is to extract data using these tools and more! ...

If Cell is This Value or That Value

IF function is frequently used in Excel worksheet to return you expect “true value” or “false value” based on the result of logical test. If you want to see if a cell is A or B, and if one of ...

If Value is Greater Than A Certain Value
If Value is Greater Than A Certain Value 1

IF function is frequently used in Excel worksheet to return you expect “true value” or “false value” based on the logical test result. If you want to see if a value in one cell is greater than a specific value, ...

If Cell is Not Blank
If Cell is Not Blank 6

IF function is frequently used in Excel worksheet to return you expect “true value” or “false value” based on the result of created logical test. If you want to see if a cell is blank or not, and leave some ...

Sidebar