قيامة المؤسس عثمان

أعلان

test

??? ???????

Post Top Ad

Your Ad Spot

الاثنين، 25 ديسمبر 2017

How to use the DATEVALUE Function (WS, VBA)

--------------------------------------------

 --------------------------------------------

This Excel tutorial explains how to use the Excel DATEVALUE function with syntax and examples.

Description

The Microsoft Excel DATEVALUE function returns the serial number of a date.
The DATEVALUE function is a built-in function in Excel that is categorized as a Date/Time Function. It can be used as a worksheet function (WS) and a VBA function (VBA) in Excel. As a worksheet function, the DATEVALUE function can be entered as part of a formula in a cell of a worksheet. As a VBA function, you can use this function in macro code that is entered through the Microsoft Visual Basic Editor.

Syntax

The syntax for the DATEVALUE function in Microsoft Excel is:
DATEVALUE( date )

Parameters or Arguments

date
A string representation of a date.

Returns

The DATEVALUE function returns a date value when used as a VBA function and it returns a serial date when used as a worksheet function. A serial date is how Excel stores dates internally and it represents the number of days since January 1, 1900.

Applies To

  • Excel 2016, Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000

Type of Function

  • Worksheet function (WS)
  • VBA function (VBA)

Example (as Worksheet Function)

Let's look at some Excel DATEVALUE function examples and explore how to use the DATEVALUE function as a worksheet function in Microsoft Excel:
Microsoft Excel
Based on the Excel spreadsheet above, the following DATEVALUE examples would return:
=DateValue(A1)
Result: 41153

=DateValue(A2)
Result: 41152

=DateValue(A3)
Result: 41501

=DateValue("30-Nov-2012")
Result: 41243

Example (as VBA Function)

The DATEVALUE function can be used in VBA code in Microsoft Excel.
Let's look at some Excel DATEVALUE function examples and explore how to use the DATEVALUE function in Excel VBA code:
Dim LDate As Date

LDate = DateValue("May 15, 2012")
In this example, the variable called LDate would now contain the value of 5/15/2012

ليست هناك تعليقات:

إرسال تعليق

Post Top Ad

Your Ad Spot

???????