Random Number Generator, but duplicate entries receive the same number

wernstrom

New Member
Joined
Sep 11, 2018
Messages
2
Hello all,

Hopefully the title says it all, but here is a bit more info.

I'm creating a mailing list where each recipient is assigned to a cohort. I have an excel table dataset with 5000+ rows, and quite a few emails appear twice.

To differentiate the emails, I made a quick n dirty COUNTIF column. if the cell=1, it is the first or only instance of that email. If cell>1, it must be a duplicate.

I wish to assign the first instance of an email address with a random number, then all subsequent instances of that email address with the same number.

I've tried using a VLOOKUP but I get a circular error:

=IF([@uniqueemail]=1,RANDBETWEEN(1,5),IF([@uniqueemail]>1,VLOOKUP([@email],Table1346,16,FALSE)))

..where 16 is the random number column. The theory is, if the email found to be a duplicate, the vlookup function should look at the email column, find the first instance of that email, look at the random number column, and return that value. It makes sense that I'm getting a circular error, but having a tough time trying to work a way around it.

Any help would be greatly appreciated
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
aaaaah naturally as soon as I pressed send, I fixed my own problem.

Had to adjust the range in VLOOKUP so that the first column aligned with my lookup value.
 
Upvote 0

Forum statistics

Threads
1,214,661
Messages
6,120,790
Members
448,994
Latest member
rohitsomani

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