Auto-populate numbers based on cell value. No duplicates.

Joined
Nov 5, 2019
Messages
9
Example sheet

I am trying to auto-populate the 'Number' column on the general sheet with values from the 'Numbers' sheet.
If the role code = IC then choose cell B2 on the numbers sheet. But if the role code is IC again then move along one cell etc so the number column always has a unique value.
If the role code = VS then it should start at 1 and continue +1 if it appears again, +2 if it appears a 3rd time etc so all role codes have an associated value that is equal to the number of times they have appeared e.g

IC - 1
IC - 2
IC - 3

or

IC - 1
VS - 1
VS - 2
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Does this do what you want?

=INDEX(Numbers!$A$1:$ZZ$999,MATCH([@[Role Code]],Table2[Code],0),COUNTIF($B$2:B2,[@[Role Code]])+1)
 
Upvote 0
Does this do what you want?

=INDEX(Numbers!$A$1:$ZZ$999,MATCH([@[Role Code]],Table2[Code],0),COUNTIF($B$2:B2,[@[Role Code]])+1)

That does :) Thank you very much.
Is it then possible to further that so for example if there were other criteria to match?

So if there were another column called 'Business Unit' for example with a two letter value {BB, AC,GG}, could the number changed based on both of these criteria? So it would be unique to both criteria?

e.g.

IC - BB - 1
CS - GG - 1
IC - AC - 1
IC - AC - 2
IC - BB - 2
CS - AC - 1
 
Upvote 0
So would the Numbers tab change format?
Does it have to use Numbers tab, what appears to be just ascending numbers in Numbers, or can I just make it the next integer?
 
Upvote 0
I think as long as each combination of role and business unit increases by one that would be fine

Then you can add a column to concatenate the two unique keys with a separation you won't use as a key and do a COUNTIF

Book1
ABCD
1ICBBIC##BB1
2CSGGCS##GG1
3ICACIC##AC1
4ICACIC##AC2
5ICBBIC##BB2
6CSACCS##AC1
Sheet1
Cell Formulas
RangeFormula
C1:C6C1=A1&"##"&B1
D1:D6D1=IF(C1="","",COUNTIF($C$1:$C1,A1&"##"&B1))
 
Upvote 0

Forum statistics

Threads
1,214,590
Messages
6,120,421
Members
448,961
Latest member
nzskater

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top