I have data in excel such as:
ID | Fee
123456789 | 100
987654321 | 100
987654321 | 75
987654321 | 50
I need to calculate a fee reduction for the items that are not the max price. The spreadsheet is sorted by ID, then Fee in the fashion needed. What I do not know how to do is use a similar row_number() over(partition by) in excel that I would normally do in SQL
Desired output would be
ID | Fee | rn
123456789 | 100 | 1
987654321 | 100 | 1
987654321 | 75 | 2
987654321 | 50 | 3
ROW_NUMBER() OVER (PARTITION BY id ORDER BY fee DESC)
is a SQL Window Function. It's essentially establishing a counter, starting at 1, for each distinct ID and incrementing it for each fee, sorted descending. If ROW_NUMBER() comes up against duplicate fee's for the ID, it will continue to increment so the row_number for that ID is distinct. – Alwynrow_number() over(parition by id order by fee desc)
, but since the data lives in an excel woorksheet the sql statement is not valid – Lutenist