Reputation: 405
I want to add rank column in my excel sheet based on Date and grouped by type
Here is the sample table:
Type | Date |
---|---|
1 Bedroom | 1/5/2024 |
1 Bedroom | 1/1/2024 |
Studio | 12/31//2023 |
Studio | 1/4/2024 |
Studio | 12/30/2023 |
I want to add a rank column based on Date so for example for 1 bedroom the rank for 1/5 will be 2 and for 1/1 will be 1 and then for studio 12/31 the rank is 1. Here is the desired output:
Type | Date | Index |
---|---|---|
1 Bedroom | 1/5/2024 | 2 |
1 Bedroom | 1/1/2024 | 1 |
Studio | 1/4/2024 | 2 |
Studio | 12/30/2023 | 1 |
Thanks for you help in advance
Upvotes: 0
Views: 76
Reputation: 152505
Use COUNTIFS()
=COUNTIFS(A:A,A2,B:B,"<="&B2)
If one has the dynamic spill functionality then one formula will spill the results:
=COUNTIFS(A:A,A2:A5,B:B,"<="&B2:B5)
Upvotes: 1