• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Generate a list of a given set of values

jj253

New Member
I'm trying to make a list of certain number of different letters: e.g. 2 "a"s, 3 "b"s and 5 "c"s, giving a a b b b c c c c c. I know how many of each number I need, but can't work out how to put this information into generating a list of them. (I would eventually like to randomise this list, e.g. to give a b b c a c c b c, if there's a way of doing this all in one step that would be great)
 
JJ253


Firstly, Welcome to the Chandoo.org Forums


You could use the Rept() function

Rept repeat the value x times


=Rept("a",4) = aaaa


so you could have a list of Values like

[pre]
Code:
A	B
1	q	2
2	w	3
3	e	2
4	r	1
5	t	3
[/pre]
then use:

=REPT(B2,C2)&REPT(B3,C3)&REPT(B4,C4)&REPT(B5,C5)&REPT(B6,C6)
 
Hi ,


You might find this helpful :


http://chandoo.org/forums/topic/repeating-items-a-specific-number-of-times-in-loop


Narayan
 
Back
Top