Hi,
Kindly help for formulas to create rows based on cell value.
Thank you!
Hi,
Kindly help for formulas to create rows based on cell value.
Thank you!
Result in Column C
Kind regards![]()
Sub test() lr = Range("A" & Rows.Count).End(xlUp).Row Range("C1") = "all id" For x = 2 To lr For i = 1 To Range("B" & x) Range("C" & Rows.Count).End(xlUp).Offset(1) = Range("A" & x) & "-" & i Next Next End Sub
Leo
Thanks Leo, but the output should be whats indicated on column E and column F, the only given data is column A B C.![]()
In E2In F2![]()
=LEFT(C2,SEARCH("_",C2,1)-1)
and copy down![]()
=C2
Kind regards
Leo
Thanks LeoTaxi! the only problem i have now is when the column C id is not the same as column A
Hi All,
if you could use an helper column...(sorry I'm at zero level with VBA)
In D2
to be copied in D2:D4![]()
=D1+B2
In E2 to be confirmed with control+shift+enter before to be copied down:
in F2 and below![]()
=IF(ROW(A1)<=MAX(D$2:D$4),INDEX(A$2:A$4,MIN(IF(D$2:D$4>=ROWS(A$1:A1),ROW(A$2:A$4)-1))),"")
Regards![]()
=IF(E2>"",E2&"_"&COUNTIF(E$2:E2,E2),E2)
Last edited by canapone; 02-18-2017 at 10:22 AM.
-----------------------------------------------------
At Excelforum, you can say "Thank you!" by clicking the star icon ("Add Reputation") below the post.
Please, mark your thread [SOLVED] if you received your answer.
Hi again
you could skip the helper column.
In E2 to be confirmed with control+shift+enter
![]()
=IF(ROWS(A$1:A1)<=MAX(SUBTOTAL(9,(OFFSET(B$2:B5,,,ROW(INDIRECT("1:"&COUNT(B$2:B$100))),1)))),INDEX(A$2:A$4,MIN(IF(SUBTOTAL(9,(OFFSET(B$2:B5,,,ROW(INDIRECT("1:"&COUNT(B$2:B$100))),1)))>=ROWS(A$1:A1),ROW(A$2:A$4)-1))),"")
In F2 (again)
![]()
=IF(E2>"",E2&"_"&COUNTIF(E$2:E2,E2),E2)
Hope that helps
Or
Cheers![]()
Sub test() lr = Range("A" & Rows.Count).End(xlUp).Row For x = 2 To lr For i = 1 To Range("B" & x) Range("E" & Rows.Count).End(xlUp).Offset(1) = Range("A" & x) Range("F" & Rows.Count).End(xlUp).Offset(1) = Range("A" & x) & "-" & i Next Next End Sub
Leo
Thanks guys both are working.
Hi,
thanks for sharing kind feedback.
Regards
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks