# Looking to Create Consecutive IDs based on Criteria

1. ## Looking to Create Consecutive IDs based on Criteria

Hello,

I'm looking to create consecutive IDs (i.e. 1, 2, 3, 4, etc.) when a row meets a certain criteria. The criteria is that the include column = "YES" and people with the same class number will have the same ID. The desired result is below and I'm looking to get the "ID" row (I also attached the document). Thank you so much for your help.

ID Class Name Include?
1 804 Last Name 1 YES
- 803 Last Name 2 NO
2 805 Last Name 3 YES
2 805 Last Name 4 YES
3 801 Last Name 5 YES
3 801 Last Name 6 YES
3 801 Last Name 7 YES
- 913 Last Name 8 NO
- 913 Last Name 9 NO
4 900 Last Name 10 YES
4 900 Last Name 11 YES
4 900 Last Name 12 YES
- 700 Last Name 13 NO
5 715 Last Name 14 YES
5 715 Last Name 15 YES

2. ## Re: Looking to Create Consecutive IDs based on Criteria

You can use this formula in cell C3:

=IF(F3="NO","-",IF(COUNTIFS(D\$3:D3,D3)=1,MAX(B\$2:B2)+1,INDEX(\$C\$3:\$C\$17,MATCH(D3,\$D\$3:\$D\$17,0))))

then copy down.

Hope this helps.

Pete

There are currently 1 users browsing this thread. (0 members and 1 guests)