Rawland Hustle
Rawland Hustle

Reputation: 781

Auto-populate every second day between two given dates

I'm currently using the formula in this article to auto-populate a column of dates between to given dates:

=ArrayFormula(TO_DATE(row(indirect("A"&A2):indirect("A"&B2))))

How can I tweak the formula to give every second date? Column D in the article would then say:

Upvotes: 0

Views: 108

Answers (3)

player0
player0

Reputation: 1

It seems like the formula skips a day if the start date is an odd date. Can this be corrected?

=ARRAYFORMULA(FILTER(TO_DATE(ROW(INDIRECT("A"&A2):INDIRECT("B"&B2))),
 MOD(ROW(INDIRECT("A1:A"&COUNTA(TO_DATE(ROW(INDIRECT("A"&A2):INDIRECT("B"&B2)))))), 2)))

0

Upvotes: 1

player0
player0

Reputation: 1

=ARRAYFORMULA(FILTER(TO_DATE(ROW(INDIRECT("A"&A2):INDIRECT("B"&B2))),
               ISODD(TO_DATE(ROW(INDIRECT("A"&A2):INDIRECT("B"&B2))))))

=ARRAYFORMULA(FILTER(TO_DATE(ROW(INDIRECT("A"&A2):INDIRECT("B"&B2))),
              ISEVEN(TO_DATE(ROW(INDIRECT("A"&A2):INDIRECT("B"&B2))))))

0

Upvotes: 0

player0
player0

Reputation: 1

=ARRAYFORMULA(FILTER(TO_DATE(ROW(INDIRECT("A"&A2):INDIRECT("B"&B2))),
                 MOD(TO_DATE(ROW(INDIRECT("A"&A2):INDIRECT("B"&B2))), 2)))

0

Upvotes: 0

Related Questions