Nov 17 2022 02:08 PM
I am taking the Google Data Analytics course. In one of our exercises, we have to find the length of a date/time, find the space within it, and display the characters following the space. The data is in the following format in the spreadsheet:
2017-09-01 00:02:01
=LEN(2017-09-01 00:02:01) should be 19, but it is coming up 15. After an hour of research, I discovered that Excel converts dates to a serial number based on a starting date of either January 1, 1900 or January 1, 1904. That's a problem because then there is no space, so
=FIND(" ", 2017-09-01 00:02:01) returns #VALUE.
That also means I cannot return the characters after the space because Excel doesn't recognize the space.
How can I prevent Excel from turning the date/time into a serial number with no spaces? I just want it to look at the date as it is displayed? Thanks!
Nov 17 2022 02:23 PM
Nov 17 2022 02:26 PM
The characters following the space are the time part of the date/time.
Let's say 2017-09-01 00:02:01 is in cell D2.
The time part is returned by the formula =MOD(D2, 1)
You'll have to format the cell with the formula as time.
If you want the result in the form of text, use =TEXT(D2, "hh:mm:ss")