Rank text cells uniquely with multiple criteria

cpaul212

New Member
Joined
Feb 6, 2022
Messages
3
How can I rank my rows uniquely without duplicates and with multiple column-criteria?

I have a Google spreadsheet with Col D, E, F, and each column is related. Col E is a sub-category of Col D, Col F is a sub-category of Col E.

These columns contain text and emoji. They are not sorted. I want to rank them (sans emoji, only text) uniquely. The ranking would be based on alphabetical sort and duplicate text values rank uniquely.

For example:
TextRank
A1
A2
B3
C4
C5

I have been able to rank based on one column, like the chart above, with these 3 formulas.

=COUNTIF($D$2:$D$1230,"<"&D2)+(COUNT($D$2:$D$1230)*ISTEXT(D2))+COUNTIF($D$2:D2,D2)

=If(D2<>"", (COUNTIF($D$2:$D$1230, "<"&D2) + (COUNT($D$2:$D$1230) * ISTEXT(D2)) + COUNTIF($D$2:D2,D2)) -8, "0")

=COUNTIF($D$2:$D$1230,"<"&D2)+COUNTIF($D$2:D2,D2)-8


They work with one column. I want to rank based on 3 columns. I want the ranking to start with Col D and continues across the row to Col E and F.

For example:

Column DColumn EColumn FRank
ABillyjazz1
Aapplehoney2
BToyotacar3
When I tried it to expand the formula to add Col E and F as criteria, none of the formulas worked.

The only one that came close was this one. But its alphabetical sort was not good.
=(COUNTIFs($D$2:$D$1230,"<="&D2, $E$2:$E$1230,"<="&E2, $F$2:$F$1230,"<="&F2) + (COUNT($D$2:$D$1230,$E$2:$E$1230,$F$2:$F$1230) * ISTEXT(D2:F2)) +COUNTIFS($D$2:D2,D2, $E$2:E2,E2, $F$2:F2,F2)) -4

And this formula duplicated the ranks of rows with the same categories (a.k.a criteria)
=(COUNTIFs($D$2:$D$1230,"<"&D2, $E$2:$E$1230,"<"&E2, $F$2:$F$1230,"<"&F2) +(COUNT($D$2:$D$1230,$E$2:$E$1230,$F$2:$F$1230) * ISTEXT(D2:F2)) +COUNTIFS($D$2:D2,D2, $E$2:E2,E2, $F$2:F2,F2))-2

Again, my data is not sorted. Here is a sample spreadsheet with unsorted data to show what I'm looking for.
WHAT I WANT:
RANK #
CATEGORY 1
CATEGORY 2
CATEGORY 3
4fruitredapple
5?fruitredstrawberry
6?fruityellowbanana
11vegetableyellowbell pepper
10vegetable?redtomato
8meatpoultrychicken
9?meatpoultryturkey
1?dairyice cream
3?dairyyogurt
2?dairymilk
7meat?fishsalmon
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Correction: with this formula, the ranking starts over again with whenever a column has new text/category.
=(COUNTIFs($D$2:$D$1230,"<"&D2, $E$2:$E$1230,"<"&E2, $F$2:$F$1230,"<"&F2) +(COUNT($D$2:$D$1230,$E$2:$E$1230,$F$2:$F$1230) * ISTEXT(D2:F2)) +COUNTIFS($D$2:D2,D2, $E$2:E2,E2, $F$2:F2,F2))-2
 
Upvote 0
Excel Formula:
=SUMPRODUCT(--(D2>$D$2:$D$1230))+SUMPRODUCT(--(D2=$D$2:$D$1230),--(E2>$E$2:$E$1230))+SUMPRODUCT(--(D2=$D$2:$D$1230),--(E2=$E$2:$E$1230),--(F2>$F$2:$F$1230))+SUMPRODUCT(--(D2=$D$2:D2),--(E2=$E$2:E2),--(F2=$F$2:F2))
 
Upvote 0
Solution
Excel Formula:
=SUMPRODUCT(--(D2>$D$2:$D$1230))+SUMPRODUCT(--(D2=$D$2:$D$1230),--(E2>$E$2:$E$1230))+SUMPRODUCT(--(D2=$D$2:$D$1230),--(E2=$E$2:$E$1230),--(F2>$F$2:$F$1230))+SUMPRODUCT(--(D2=$D$2:D2),--(E2=$E$2:E2),--(F2=$F$2:F2))
It worked!! Thank you!
 
Upvote 0

Forum statistics

Threads
1,215,078
Messages
6,122,996
Members
449,093
Latest member
masterms

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