Applying a formula to a subset of rows

rodqntr

New Member
Joined
Feb 26, 2024
Messages
4
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I will try to be as clear as possible. I have the following data:

ROW \ COLUMNABCDEF
1IDErrorTypeRankEvaluationCount
2B001Missed XCriticalA1
3B001Missed YCriticalA2
4B001Missed ZCriticalA3
5B001Incorrect AModerateB1
6B001Incorrect BModerateB2
7B001Incorrect CModerateB3
8B002Missed XCriticalA1
9B002Missed ZCriticalA3
10B002Incorrect CModerateB3

I need to find ONE formula in column Evaluation (even if it is by putting together multiple formulas) that does the following:

1. Evaluate (count) how many times the combination ID/Type and only display the counter on first instance
2. Evaluate the highest rank but only on the subset of rows based on the count
3. If evaluated row result is the row with the highest rank, then display Error

What I have been able to come up with:
General countif to evaluate instances ID/Type =IF(AND(A2=A1,C2=C1),"",COUNTIFS(A:A,A2,C:C,C2)
General formula to evaluate highest rank =IF(LOOKUP(1,0/FREQUENCY(1,COUNTIF(D2:D10,"<="&D2:D10)),D2:D10)=A1,B1,"")
However, the rank evaluation uses the full range. It should only evaluate where ID/Type is the same and once there is a change on ID/Type then start over
example row 1 - 3 is one evaluation, then 4-6, then 7-8, and then 8 by itself as there are no more entries

expected results:
ROW\COLUMNABCDEF
1IDErrorTypeRankEvaluationCount
2B001Missed XCriticalA1Missed X3
3B001Missed YCriticalA2
4B001Missed ZCriticalA3
5B001Incorrect AModerateB1Incorrect A3
6B001Incorrect BModerateB2
7B001Incorrect CModerateB3
8B002Missed XCriticalA1Missed X2
9B002Missed ZCriticalA3
10B002Incorrect CModerateB3Incorrect C1
 

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.
Edit: example: rows 2-4 is one evaluation, then rows 5-7, then rows 8-9, and then row 10 by itself as there are no more entries
 
Upvote 0
Edit2: found a small typo on the formula, it should be =IF(LOOKUP(1,0/FREQUENCY(1,COUNTIF(D2:D10,"<="&D2:D10)),D2:D10)=A2,B2,"")
 
Upvote 0

Forum statistics

Threads
1,215,076
Messages
6,122,984
Members
449,092
Latest member
Mr Hughes

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