Google-sheets – How to apply DATEVALUE to column

google sheetsgoogle-sheets-arrayformula

I have two columns with extracted date values. I want to add those two values together and apply to the whole column. The data looks like this:

AM     AN          AO      AP          AQ 
date    time        year    day value   time value 
Oct 12  14:15:00    2020    #N/A        0.59375

I want to concatenate or join the values of AM and AO, pass to DATEVALUE, and apply to the whole column. Current the formula for AP is:

=DATEVALUE(concatenate(AM2,", ",AO2))

But I cannot apply this using ArrayFormula.

I've tried using CONCAT, JOIN, and & on the two values without success, e.g.

=ArrayFormula(DATEVALUE(AM2:AM & AO2:AO))

Best Answer

You can try the following formula

=ArrayFormula((V2:V5&"-"&MONTH(T2:T5)&"-"&DAY(T2:T5))*1)

enter image description here

(Please adjust ranges to your needs)

If you want to apply for the whole range you can use:

=ArrayFormula(IF(V2:V="",,(V2:V&"-"&MONTH(T2:T)&"-"&DAY(T2:T)*1)))  

EDIT

Following OP's request

I actually wanted to keep this in the Datevalue format, e.g. 44116 instead of 10/12/2020.

Please use the following arrayformula

=ArrayFormula(IF(V2:V="",,((V2:V&"-"&MONTH(T2:T)&"-"&DAY(T2:T))*1)))

DO notice the extra parenthesis. They make all the difference.
Using this second formula you get the results as datevalues. If you then want to have them as dates, you can format them from the Format -->Number -->Date menu according to your preferences.

Functions used: