Forum Discussion
Jonathan_2112
Oct 09, 2022Copper Contributor
DATEVALUE Function returns #VALUE! Error
I'v tried setting cell format to Text, any thoughts?
Jonathan_2112
Oct 09, 2022Copper Contributor
I an using a cell as the argument. The Cell is date formatted MM/DD/YY
- HansVogelaarOct 09, 2022MVP
If the cell used as argument already contains a "real" date, there is no point in using DATEVALUE.
DATEVALUE expects a text string that looks like a date as argument.
If A1 contains the date 10/09/22, =DATEVALUE(A1) will return #VALUE!
If A1 contains a text value that looks like 10/09/22, =DATEVALUE(A1) will return the date 10/09/22.
- Jonathan_2112Oct 09, 2022Copper ContributorOK, yes, but I wish to create the serial number form of the date for sorting.
- HansVogelaarOct 09, 2022MVP
Excel stores dates as numbers, so you can sort them directly, without converting them to numbers.
For example:
10/09/2022 is stored as 44843
10/10/2022 is stored as 44844
10/11/2022 is stored as 44845
etc.
You can check this by setting the number format of a range with dates temporarily to General.
(Don't forget to restore the date format afterwards)