I have several columns of data, imported via ImportXml
from a website, in which all dates are formatted like this:
A | B | Year for A | Year for B |
---|---|---|---|
Jan 22 | Feb 3 | =Sequence(366-21, 1, 2020, 0) |
=Sequence(366-31-2, 1, 2020, 0) |
Jan 23 | Feb 4 | ||
...one row | per day | in 2020... | |
Dec 31 | ... | ||
Jan 1 | ... | =Sequence(365, 1, 2021, 0) |
|
... | ... |
I need to convert these to real dates, so need a year (starting with 2020). I currently fill in the year columns via Sequence
, which is hasslesome because I need to put in a custom formula for each column based on the start date, and I need to repeat the sequence for each new year.
Does somebody have a better idea?
text conversion to date is done like this:
=ARRAYFORMULA(IF(A2:B="",,A2:B*1))
=INDEX(IF(A2:A="",, DATE(2020+IFNA(VLOOKUP(ROW(A2:A), IF(
IFERROR(1/(1/COUNTIFS(A2:A, A2:A, A2:A, "=jan 1",
ROW(A2:A), "<="&ROW(A2:A))))<>"", {ROW(A2:A),
IFERROR(1/(1/COUNTIFS(A2:A, A2:A, A2:A, "=jan 1",
ROW(A2:A), "<="&ROW(A2:A))))}), 2, 1), 0), MONTH(A2:A*1), DAY(A2:A*1))))
=INDEX(IF(B2:B="",, DATE(2020+IFNA(VLOOKUP(ROW(B2:B), IF(
IFERROR(1/(1/COUNTIFS(A2:A, A2:A, A2:A, "=dec 31",
ROW(B2:B), "<="&ROW(B2:B))))<>"", {ROW(B2:B),
IFERROR(1/(1/COUNTIFS(A2:A, A2:A, A2:A, "=dec 31",
ROW(B2:B), "<="&ROW(B2:B))))}), 2, 1), 0), MONTH(B2:B*1), DAY(B2:B*1))))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.