Creating duplicate cells based on another cell value

ArtemisJay

New Member
Joined
Oct 19, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
First thread and hoping someone can help.

As part of a reward and recognition incentive at work this month, I’m running a type of raffle. As we work from different sites around Australia, we’re keeping everything digital and recorded using Excel.

I’m wanting to be able to create a vertical list of names and assign random numbers to each then draw randomly from the total for winners.

Is there a way that I can duplicate someone’s name in a spreadsheet multiple times, based on how many tickets into the raffle they’ve been given? I currently have it set as something like Column A is the name of the person and Column B is how many tickets they have.

For example: John has 6 tickets and Jane has 5. I would want the list to be
John
John
John
John
John
John
Jane
Jane
Jane
Jane
Jane

Either an obscure formula or VBA. I’m down for either.

Thanks in advance.
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Hi ArtemisJ,

Can I have a counter column? If so then is this obscure enough?

ArtemisJ.xlsx
ABCDEF
1NameTicketsCounterResult
2John66John
3Jane511John
4Jim314John
5John
6John
7John
8Jane
9Jane
10Jane
11Jane
12Jane
13Jim
14Jim
15Jim
16 
Sheet1
Cell Formulas
RangeFormula
C2:C4C2=SUM($B$2:B2)
F2:F16F2=IFERROR(INDEX($A$2:$A$11,MATCH(AGGREGATE(15,6,$C$2:$C$11/(ROW()-ROW($F$1)<=$C$2:$C$11),1),$C$2:$C$11,0)),"")
 
Upvote 0
Solution
Lets assume that the names are in A1:A3, and the number of raffles tickets against each is logged in B1:B3.

Try:

=FILTERXML("<t><s>"&CONCAT(REPT(A1:A3&"</s><s>",B1:B3))&"</s></t>","//s")
 
Upvote 0
With a slight tweak to Jon's idea & random numbers
+Fluff 1.xlsm
ABCDE
1NameTickets
2John6John485
3Jane5John353
4Jim3John443
5Bob1John292
6Sue4John240
7Mary5John133
8Jane415
9Jane188
10Jane191
11Jane447
12Jane225
13Jim245
14Jim275
15Jim376
16Bob368
17Sue195
18Sue461
19Sue224
20Sue364
21Mary186
22Mary461
23Mary343
24Mary332
25Mary264
26
Lists
Cell Formulas
RangeFormula
D2:D25D2=FILTERXML("<t><s>"&CONCAT(REPT(A2:A7&"</s><s>",B2:B7))&"</s></t>","//s[position()<="&SUM(B2:B7)&"]")
E2:E25E2=RANDARRAY(ROWS(D2#),,100,500,1)
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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