• 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.

Repeating items a specific number of times in loop

Debraj

Excel Ninja
Hi Friends,


Can someone help to create a Formula, for repeating Items a Specific Number of times, in loop..

[pre]
Code:
Z	5
Y	2
X	1
W	4
then Z 5 Times, Y 2 Times.... but in series

expected output

Z
Y
X
W
Z
Y
W
Z
W
Z
W
Z
[/pre]
Regards,

Deb


PS: Cross-post @ http://www.get-digital-help.com/2013/01/18/repeat-values/#comment-53273
 
Hi Deb,


I am trying to improve it but here it is:


A1:B4 is your data.

In D7 Write 1.

In D8 =IF(D7<4,D7+1,1) and drag down

In E7 =INDEX($A$1:$A$4,D7,1) and drag down

In F7 =IF(COUNTIF($E$7:E7,E7)<=VLOOKUP(E7,$A$1:$B$4,2,0),E7,0)

In =IFERROR(INDEX($F$7:$F$44,SMALL(IF(ISNUMBER($F$7:$F$44)=FALSE,ROW($D$1:$D$38)),ROW(A1)),0),"") Press Ctrl+Shift+Enter and drag. Its Monday morning so overloaded with work but as i said, am trying to remove helper column.


Regards,
 
Hi Faseeh,


Thanks for the help..

I am still in search of some shorter logic..


"khuda hafiz"
 
Hi All,


Solved..


http://www.get-digital-help.com/2013/01/18/repeat-values/#loop


Code:
=INDEX($A$1:$A$4, MATCH(MIN(IF(COUNTIF($A$5:A5, $A$1:$A$4)=$B$1:$B$4, "", COUNTIF($A$5:A5, $A$1:$A$4))), IF(COUNTIF($A$5:A5, $A$1:$A$4)=$B$1:$B$4, "A", COUNTIF($A$5:A5, $A$1:$A$4)), 0))


(in the bottom part)


Regards,

Deb
 
Back
Top