Alphabetize names with a dynamic range

Stuepef

Board Regular
Joined
Oct 23, 2017
Messages
128
Office Version
  1. 2021
Platform
  1. Windows
I have a formula that makes a list of unique employee names that I am trying to alphabetize. The problem is there can be 2-50 (range A1:A50) employees within the list causing the alphabetize rank formula to count blank or 0 cells due to having a formula in that cell. Is there a way to use a dynamic range formula to not include the cells that contain 0 or blanks? So would it be possible to have the COUNTIF dynamically rank A1:A10 since A11:A50 are blank?

Current formula in B1:
Code:
=COUNTIF($A$1:$A$50,"<="&A1)

Desired Result:
[TABLE="class: outer_border, width: 500"]
<tbody>[TR]
[TD]Employee name[/TD]
[TD]Alphabetize rank[/TD]
[/TR]
[TR]
[TD]GRAY,BOBBY F[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]PARK,AMY G[/TD]
[TD]7[/TD]
[/TR]
[TR]
[TD]JOHNSON,BONNIE[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]HARTFORD,ERIN Q[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]STEEL,ASHLEY[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD]DOWEL,LOUIS[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]WORD,LARRY F[/TD]
[TD]9[/TD]
[/TR]
[TR]
[TD]DUNCAN,HARRY W[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]YOUNG,RICK R[/TD]
[TD]10[/TD]
[/TR]
[TR]
[TD]KNIGHT,MELISSA R[/TD]
[TD]6[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Hello,

Why don't you modify your initial formula which creates the Unique Names ... to also sort the results alphabetically ...

Say your initial list is located in A2:A50 ... you could use in cell B2 the following Array Formula :


Code:
=INDEX(yourlist,MATCH(0,countif(yourlist,"<"&yourlist)-sum(countif(yourlist,B$1:B1))

Hope this will help
 
Upvote 0
@James006 - The formula results in #N/A error.
Code:
{=INDEX($A$2:$A$11,MATCH(0,COUNTIF($A$2:$A$11,"<="&A2)-SUM(COUNTIF($A$2:$A$11,B$1:B1))))}
 
Upvote 0
Sorry ...

But just tested it ... and it works fine ...

We do agree this is an Array Formula ...

Instead of the Enter key ... use simultaneously the three keys : Control Shift Enter

Code:
=IFERROR(INDEX($A$2:$A$11,MATCH(0,COUNTIF($A$2:$A$11,"<"&$A$2:$A$11)-SUM(COUNTIF($A$2:$A$11,B$1:B1)),0)),"")
 
Upvote 0
@James006 - the formula works great for the range A2:A11, but the true range is A2:A50. This is causing the issue as the formula is trying to rank the cells that have formulas in them, but no names. Thats why I was trying to figure out a way to use a dynamic range that only uses cells with names in them. The desired formula would use range A2:A50, but only rank A2:A11 since they have names populated in the cells.
 
Upvote 0

Forum statistics

Threads
1,224,817
Messages
6,181,144
Members
453,021
Latest member
Justyna P

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