Jo Loh
Jo Loh

Reputation: 1

How to create an autonumbering formula based on three columns

I'm trying to create a formula that will automatically generate a numeric code for each combination of columns. The first column is populated by a dropdown list, so that's an easy if-then formula (make in the attached image). The hard part is assigning column B a value that restarts when there is a new "make", and yet assigns the same value if that make is already entered. And then tougher yet is to assign a colour code that also restarts when there is a new model.

So, in the image provided, in column A, users pick their make. Honda will auto populate "1." into column D. Then the user enters the make into column B. Row 2 will add "1." into the code for the first entry (Accord), "2." for the second entry, etc. But if one of those models gets entered again in a lower row, the code will remember what was already assigned.

Same idea for column D.

I can't make only drop-down lists for the model and colour column - users need to be able to enter custom values (it's not for make-model-colour - I'm just using that as an example to show what I need).

I've tried using countif and if-then statements using arrays, but it's not working. Any solutions would be greatly appreciated.

Image of Table

Image of Table

Markdown

Name Model Colour
Honda Accord Black
Honda Civic Red
Toyota Rav4 Silver
Honda Accord Blue
Ford F-150 Onyx
Ford F-150 White
Chevrolet Silverado Moonlight
Ford F-150 Steel
Chevrolet Silverado Pearl
Audi Q4 Midnight
Audi Q4 Chrome
Audi Q8 Night
Audi Q4 Gunmetal

Upvotes: 0

Views: 73

Answers (1)

Black cat
Black cat

Reputation: 6314

Let try this formula: The formula is in cell D2 and drag (copy) down.

=MATCH(A2,UNIQUE(A$2:A2),0)&"."&MATCH(B2,UNIQUE(FILTER(B$2:B2,A2=A$2:A2)),0)&"."&MATCH(C2,UNIQUE(FILTER($C$2:$C2,A$2:A2&B$2:B2=A2&B2)),0)

enter image description here

Upvotes: 0

Related Questions