VBABEGINER
Well-known Member
- Joined
- Jun 15, 2011
- Messages
- 1,284
- Office Version
- 365
- Platform
- Windows
Pls teach me how this formula works..
DateValue and TimeValue
DateValue and TimeValue
Dates and times are numbers.
DATEVALUE and TIMEVALUE convert text (formatted) dates and times to true dates and times.
[TABLE="class: grid"]
<tbody>[TR]
[TD]Row\Col[/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD][/TD]
[TD]input[/TD]
[TD]isnumber?[/TD]
[TD]datevalue[/TD]
[TD]isnumber?[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD][1][/TD]
[TD]5/8/2018[/TD]
[TD]FALSE[/TD]
[TD]43228[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD][2][/TD]
[TD]May 8 2018[/TD]
[TD]FALSE[/TD]
[TD]#VALUE![/TD]
[TD]FALSE[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD][3][/TD]
[TD]5/8/2018[/TD]
[TD]FALSE[/TD]
[TD]43228[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD][4][/TD]
[TD]5/8/2018[/TD]
[TD]TRUE[/TD]
[TD]#VALUE![/TD]
[TD]FALSE[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD][5][/TD]
[TD]08-05-18[/TD]
[TD]FALSE[/TD]
[TD]43317[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
C2 houses:
=ISNUMBER(B2)
which is copied down.
D2 houses:
=DATEVALUE(B2)
which is copied down.
E2 houses again an isnumber test:
=ISNUMBER(D2)
copied down.
[1] contains:
'5/8/2018
[2] contains:
May 8 2018
[3] contains:
="5/8/2018"
[4] contains:
=TODAY()
[5] contains:
=TEXT(TODAY(),"dd-mm-yy")
The foregoing can be easily set up to observe the behavior of TIMEVALUE.
By the way, the following is what the 2016 version writes about DATEVALUE...
"DATEVALUE function This article describes the formula syntax and usage of the DATEVALUE function in Microsoft Excel. The DATEVALUE function converts a date that is stored as text to a serial number that Excel recognizes as a date. For example, the formula =DATEVALUE("1/1/2008") returns 39448, the serial number of the date 1/1/2008."