How to create a specified number of rows for each date?

alexcr

Board Regular
Joined
Oct 15, 2018
Messages
59
Office Version
  1. 365
Platform
  1. Windows
Let's say that in Cells A1-A7 there are seven dates, and in Cells B1-B7 there are the number of rows you'd like per date.

From A9 downward, you'd like to list each date the number of times specified. For example...

• If Cell A1 contains "7/12/21" and Cell B1 contains "3", then Cells A9-A11 would all be "7/12/21".

• If Cell A2 contains "7/15/21" and Cell B2 contains "2", then Cells A12-A13 would all be "7/15/21".

• If Cell A3 contains "7/18/21" and Cell B3 contains "0", then this date would be skipped.

• And so on.

Is there a formula or formulas that can automatically generate these cells/rows? Thanks in advance!
 
You cannot use the filterxml function on a Mac, it only exists on a PC.
 
Upvote 0

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
So glad you caught that Fluff. I was about to go down a rabbit hole trying to figure out why that wasn't working.

Do Macs get Power Query?
 
Upvote 0
If you need it to work on a Mac, how about
+Fluff 1.xlsm
ABCD
1
2
3
4
5
6
7
817/07/20211
917/07/202118/07/20212
1018/07/202119/07/20210
1118/07/202120/07/20210
1221/07/202121/07/20213
1321/07/202122/07/20211
1421/07/202123/07/20214
1522/07/202124/07/20217
1623/07/2021
1723/07/2021
1823/07/2021
1923/07/2021
2024/07/2021
2124/07/2021
2224/07/2021
2324/07/2021
2424/07/2021
2524/07/2021
2624/07/2021
27
Main
Cell Formulas
RangeFormula
A9:A26A9=LET(Rng,C8:C15,Txt,"|"&TEXTJOIN(,,REPT(ROW(Rng)-MIN(ROW(Rng))+1&"|",D8:D15)),Qty,SEQUENCE((LEN(Txt)-LEN(SUBSTITUTE(Txt,"|","")))-1),Ary,REPLACE(LEFT(Txt,FIND("~",SUBSTITUTE(Txt,"|","~",Qty+1))-1),1,FIND("~",SUBSTITUTE(Txt,"|","~",Qty)),""),INDEX(Rng,Ary))
Dynamic array formulas.
 
Upvote 0
Solution
Thanks, @Fluff. This works in Mac.

@lrobbo314, the odd thing is that the formula stopped working in Windows, as well. (I have both Mac and Windows PCs, and use Excel on both.) Maybe it's because I opened the file on a Mac and subsequently opened it in Windows, and that somehow corrupted the formula and/or workbook? Not sure.
 
Upvote 0
How many rows were you trying to fill when it failed on Windows?
 
Upvote 0
That number of rows shouldn't have caused a problem, so not sure why it failed.
 
Upvote 0

Forum statistics

Threads
1,214,788
Messages
6,121,597
Members
449,038
Latest member
Arbind kumar

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