Sort A to Z Ignore blanks

hajiali

Well-known Member
Joined
Sep 8, 2018
Messages
626
Office Version
  1. 2016
Platform
  1. Windows
this code below will Sort the Columns However, It puts the blank cells on top

Code:
Sub SortRampLog()    ActiveWorkbook.Worksheets("RAMP LOG (2)").AutoFilter.Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("RAMP LOG (2)").AutoFilter.Sort.SortFields.Add Key:= _
        Range("A2:A1000"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption _
        :=xlSortNormal
    With ActiveWorkbook.Worksheets("RAMP LOG (2)").AutoFilter.Sort
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
End Sub

In row A2:a1000 I have the following code

Code:
=IFERROR(CONCATENATE(INDEX('EMPLOYEE LIST'!$D$2:$D$1000,MATCH(B3,'EMPLOYEE LIST'!$B$2:$B$1000,0)),", ",INDEX('EMPLOYEE LIST'!$C$2:$C$1000,MATCH(B3,'EMPLOYEE LIST'!$B$2:$B$1000,0)))," ")

I have tried Putting "0" and "-" if error happens
any suggestions is very appreciative
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
In the event of an error, your IFERROR formula is returning a space (" "). Try changing that to a zero-length string ("").
 
Upvote 0
Tried "" and still same results when i Sort A to Z Blanks at the top.
 
Upvote 0
I got it figured out. for anyone that would like to know just Remove the Iferror

Code:
[COLOR=#333333]CONCATENATE(INDEX('EMPLOYEE LIST'!$D$2:$D$1000,MATCH(B3,'EMPLOYEE LIST'!$B$2:$B$1000,0)),", ",INDEX('EMPLOYEE LIST'!$C$2:$C$1000,MATCH(B3,'EMPLOYEE LIST'!$B$2:$B$1000,0)))[/COLOR]

The cells will have "#N/A" but will not sort those cells with "N/A"
 
Upvote 0

Forum statistics

Threads
1,223,892
Messages
6,175,236
Members
452,621
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top