Repeat value of each cell N times according to value of the neighboring cell

The table below has two columns, where column B is number.


A

B

1

flower

4

2

apple

6

We need to repeat value of column A N times according to the value of column B and concatenate results into one column.


E

1

flower

2

flower

3

flower

4

flower

5

apple

6

apple

7

apple

8

apple

9

apple

10

apple

Use SPL XLL to do this:

=spl("=?.conj(~2*[~1])",A1:B2)

Picture8png

conj() function concatenates members of a sequence; ~2 represents the 2nd child member of the current member; "integer N* sequence" means copying each member of a sequence N times.

Source:https://www.reddit.com/r/excel/comments/1cqi45b/how_to_repeat_multiple_cells_x_number_of_times/