1

I got into a bit of problem. I have data like this

   Date     Repeat

 7-Oct-2018    1
 8-Oct-2018    1
 9-Oct-2018    2
10-Oct-2018    2
11-Oct-2018    3
12-Oct-2018    2
13-Oct-2018    1

Now the result i want is a column where the date is repeated as per the repeat numbers, like this.

    Result

 7-Oct-2018
 8-Oct-2018
 9-Oct-2018
 9-Oct-2018
10-Oct-2018
10-Oct-2018
11-Oct-2018
11-Oct-2018
11-Oct-2018
12-Oct-2018
12-Oct-2018
13-Oct-2018

So how can i get this result. Please do help

Shijilal
  • 2,175
  • 10
  • 32
  • 55

1 Answers1

2

I tried to think of it for own study. For example, how about this sample formula? I think that there might be simpler formulas. So please think of this as one of them. When you use this, please put the following formula to a cell.

=TRANSPOSE(SPLIT(JOIN(",",ARRAYFORMULA(REPT(A2:A8&",",B2:B8))),","))

This formula supposes that the values of Date and Repeat are put in A2:A8 and B2:B8, respectively.

  • Show repeatedly Date using REPT(). At this time, , is used as a delimiter.
  • Join each cell with , using JOIN().
  • Split the cell with , using SPLIT().
  • Transpose the cells using TRANSPOSE().

I think that you can also use CONCATENATE() and TEXTJOIN() for joining cells.

References:

Tanaike
  • 181,128
  • 11
  • 97
  • 165
  • @Shijilal Thank you for replying. I'm glad your issue was solved. Also I could study from your question. Thank you, too. – Tanaike Oct 23 '18 at 05:32
  • Hello there.. if you got time could you check this one too for me. https://stackoverflow.com/questions/52952904/lopping-through-a-set-of-values-in-google-sheet – Shijilal Oct 23 '18 at 15:38
  • @Shijilal Thank you for your comment. I'm sorry for my late reply. I saw it just now. I knew that a nice answer has already been posted. I think that it will resolve your issue. – Tanaike Oct 23 '18 at 21:49
  • Thanks for responding. Yes got one solution. Will get in touch with you if any more issues. Thanks :) – Shijilal Oct 24 '18 at 01:18
  • if time permits,could you check these 2 questions please. 1. https://stackoverflow.com/questions/52964418/adding-blank-rows-in-a-set-of-data-in-google-sheets 2. https://stackoverflow.com/questions/52963740/looping-through-a-set-of-google-sheet-values – Shijilal Oct 24 '18 at 08:55
  • @Shijilal Thank you for your comments. I'm really sorry for my late response. I saw them just now. But some answers has already been posted, and it seems under discussing for resolving. – Tanaike Oct 24 '18 at 22:37