To add in numbers in an array I can do:
={1,2,3}
To add in text in an array I can do:
={"a","b","c"}
How would I enter in a date? For example, normally I can type in something like 1/1/07
in a cell and it will recognize it as a date. How would I enter that in into an array, such as:
={11/21/86, 11/1/14}
CodePudding user response:
Use DATE
function combined with HSTACK
as follow:
=HSTACK(DATE(2022,1,14), DATE(2022,5,20))
the array form {}
is only for constants (literals). If you want the information in date format this is one way of doing it. Another way is to use string literals and then convert it to a date format as follow:
=DATEVALUE({"2022/1/14","2022/5/20"})
In both cases the date should be in the following range: from January 1, 1900 to December 31, 9999.