MrVocabulary
MrVocabulary

Reputation: 654

Excel: Autonumber cells based on adjacent cell value in a continuous way

after some research and attempts I am unable to create a formula that I need. Basically, what I have now is this:

enter image description here

The formula: =IF(XOR(NOT(ISBLANK(B11)),NOT(EXACT($B11,$B10))),"",COUNTA(B$2:B11))

But what I want is this:

enter image description here

In other words, I want to count in column A and show consecutive numbers for each new unique, non-blank value in column B, without it "skipping" the numbers.

Upvotes: 0

Views: 208

Answers (1)

SJR
SJR

Reputation: 23081

Try this

=IF(ISBLANK(B2),"",IF(B2<>B1,MAX($A$1:A1)+1,""))

If the value in B is a new one, look for the previous highest number in A and add 1, otherwise do nothing.

Upvotes: 2

Related Questions