Excel DateValue Function

 

Excel DateValue Function

 

 

The Excel DateValue Function is used to return a variant variable, which contains a date value.

 

 

 

The Basics:

 

 

DateValue(Date)

 

 

Now let’s look at an example. Let’s assume that I have a string value on an Excel worksheet which I want to convert to a date variable.

 


 

 

Code

 

 

Dim ValueToProcess As Variant 'Variable to hold the string to be processed


 

 ValueToProcess = DateValue(ActiveSheet.Cells(1, 1).Value)


 

 ActiveSheet.Cells(3, 1).Value = ValueToProcess


 

Output


 


 

 

 

Note:

 

So why do we need this Excel function? The Excel DateValue is a great function to automatically convert a string for assignment to a date variable when you need it.

 


 

 

 

 

 
Sitemap | Privacy | Terms
Microsoft ® and Microsoft Excel ® are registered trademarks of Microsoft Corporation.
Copyright 2011 ExcelHelp.com All rights reserved
More Info (+)