What is excel date value

Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel for the web Excel 2021 Excel 2021 for Mac Excel 2019 Excel 2019 for Mac Excel 2016 Excel 2016 for Mac Excel 2013 Excel 2010 Excel 2007 Excel for Mac 2011 Excel Starter 2010 More…Less

This article describes the formula syntax and usage of the DATEVALUE function in Microsoft Excel.

Description

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. Remember, though, that your computer’s system date setting may cause the results of a DATEVALUE function to vary from this example

The DATEVALUE function is helpful in cases where a worksheet contains dates in a text format that you want to filter, sort, or format as dates, or use in date calculations.

To view a date serial number as a date, you must apply a date format to the cell. Find links to more information about displaying numbers as dates in the See Also section.

Syntax

DATEVALUE(date_text)

The DATEVALUE function syntax has the following arguments:

  • Date_text    Required. Text that represents a date in an Excel date format, or a reference to a cell that contains text that represents a date in an Excel date format. For example, «1/30/2008» or «30-Jan-2008» are text strings within quotation marks that represent dates.

    Using the default date system in Microsoft Excel for Windows, the date_text argument must represent a date between January 1, 1900 and December 31, 9999. The DATEVALUE function returns the #VALUE! error value if the value of the date_text argument falls outside of this range.

    If the year portion of the date_text argument is omitted, the DATEVALUE function uses the current year from your computer’s built-in clock. Time information in the date_text argument is ignored.

Remarks

  • Excel stores dates as sequential serial numbers so that they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,447 days after January 1, 1900.

  • Most functions automatically convert date values to serial numbers.

Example

Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter. If you need to, you can adjust the column widths to see all the data.

Data

11

3

2011

Formula

Description

Result

=DATEVALUE(«8/22/2011»)

Serial number of a date entered as text.

40777

=DATEVALUE(«22-MAY-2011»)

Serial number of a date entered as text.

40685

=DATEVALUE(«2011/02/23»)

Serial number of a date entered as text.

40597

=DATEVALUE(«5-JUL»)

Serial number of a date entered as text, using the 1900 date system, and assuming the computer’s built-in clock returns 2011 as the current year.

39634

=DATEVALUE(A2 & «/» & A3 & «/» & A4)

Serial number of a date created by combining the values in cells A2, A3, and A4.

40850

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Функция DATEVALUE (ДАТАЗНАЧ) в Excel используется для тех ситуаций, когда дата в ячейке указана в виде текста. С её помощью Excel конвертирует текстовое значение даты в число, которое система распознает как дату.

Содержание

  1. Какие данные отображает
  2. Синтаксис
  3. Аргументы
  4. Дополнительная информация
  5. Примеры использования функции DATEVALUE (ДАТАЗНАЧ)
  6. Пример №1. Преобразование даты в текстовом формате в число
  7. Пример №2. Преобразование даты в текстовом формате с помощью формулы
  8. Пример №3. Использование функции без указания года
  9. Пример №4. Использование функции без указания дня

Какие данные отображает

Функция возвращает дату в виде числового значения, понятного по формату для Excel. Например, если мы используем функцию =DATEVALUE («1/1/2016») или =ДАТАЗНАЧ(«1/1/2016») , она будет возвращать число 42370, которое является числовым значением даты 01-01-2016.

Синтаксис

=DATEVALUE (“date_text”) — английская версия
=ДАТАЗНАЧ («дата_как_текст»)
— русская версия

Аргументы

date_text (дата_как_текст): это аргумент даты указанной в ячейке в формате текста или результат какой-либо формулы в виде текста;

  • для правильной работы функции, текст, который нам необходимо преобразовать в формулу важно указать в кавычках (прим. “01/01/2016”);
  • если date_text это результат какого-либо вычисления, важно чтобы ячейка была в текстовом формате, для корректной работы функции.

Дополнительная информация

DATEVALUE (ДАТАЗНАЧ) возвращает числовое значение даты:

  • Например: формула =DATEVALUE(“1/1/2014”) или =ДАТАЗНАЧ(“1/1/2014”) преобразует значение в число 41640, которое означает дату 1 января 2014 в формате даты.
  • Если вы указываете дату без дня (прим. =DATEVALUE(“1/2014”) или =ДАТАЗНАЧ(“1/1/2014”), а только месяц и год, система вернет числовое значение даты как первого дня указанного месяца — 41640, что для Excel будет означать как 01.01.2014.
  • Если вы не используете значение года (прим. =DATEVALUE(“01/04”) или =ДАТАЗНАЧ(“01/04”), Excel автоматически присвоит текущий год (указанный в настройках даты и времени вашей ОС).
  • Формат значения даты, которую выдает функция, зависит от настроек вашей ОС. Например в России (по умолчанию) при преобразовании даты 01/03/2016 это будет 1 Марта 2016, в США это 3 Января 2016.

Примеры использования функции DATEVALUE (ДАТАЗНАЧ)

Пример №1. Преобразование даты в текстовом формате в число

Функция в Excel - DATAVALUE (ДАТАЗНАЧ)

В приведенном выше примере, формула возвращает числовое значение даты введенной в кавычках. Введенная дата должна быть в текстовом формате, иначе Excel возвращает “#VALUE!” ошибку.

Обратите внимание, что значение, возвращаемое функцией зависит от настройки часов вашей системы. Если дата указана в формате ДД-ММ-ГГГГ значит «01-06-2016» будет отображать как 1 июня 2016 года, но для формата даты ММ-ДД-ГГГГ дата будет отображаться как 6 января 2016.

Telegram Logo Больше лайфхаков в нашем Telegram Подписаться

Пример №2. Преобразование даты в текстовом формате с помощью формулы

Функция DATEVALUE (ДАТАЗНАЧ)

Когда дата введена как текст в ячейку, вы можете использовать функцию DATAVALUE (ДАТАЗНАЧ), чтобы получить числовое значение даты. Обратите внимание, что дата должна быть в текстовом формате.

В приведенном выше примере, формула преобразует “1-6-16” и “1-июня-16” — это значение указанное в формате даты.

Эта функция полезна, когда у вас есть дата в текстовом формате, по которой вы хотите фильтровать, сортировать данные в таблице. В текстовом формате, вы не сможете сортировать даты и проводить вычисления в Excel, так как система будет рассматривать его как текст, а не число.

Пример №3. Использование функции без указания года

Функция DATAVALUE (ДАТАЗНАЧ) в Excel

Если значение года не указано, то система использует текущий год при отображении значения даты (текущий год 2016 в указанном примере).

Пример №4. Использование функции без указания дня

Функция DATEVALUE (ДАТАЗНАЧ) в Excel

Если в дате не указан день, то формула использует первый день месяца.

В приведенных выше примерах, когда мы вводим число «6-16», система возвращает число 42522, которое является значением даты на 1 июня 2016 года.

Содержание

  1. Date and time functions (reference)
  2. DATE function
  3. DATEVALUE function
  4. Description
  5. Syntax
  6. Remarks
  7. Example
  8. DATEVALUE Function
  9. What is the DATEVALUE Function?
  10. Formula
  11. How to use the DATEVALUE Function in Excel?
  12. Example 1
  13. Example 2
  14. Example 3
  15. Notes about the DATEVALUE Function
  16. Additional Resources

Date and time functions (reference)

To get detailed information about a function, click its name in the first column.

Note: Version markers indicate the version of Excel a function was introduced. These functions aren’t available in earlier versions. For example, a version marker of 2013 indicates that this function is available in Excel 2013 and all later versions.

Returns the serial number of a particular date

Calculates the number of days, months, or years between two dates. This function is useful in formulas where you need to calculate an age.

Converts a date in the form of text to a serial number

Converts a serial number to a day of the month

DAYS function

Returns the number of days between two dates

Calculates the number of days between two dates based on a 360-day year

Returns the serial number of the date that is the indicated number of months before or after the start date

Returns the serial number of the last day of the month before or after a specified number of months

Converts a serial number to an hour

ISOWEEKNUM function

Returns the number of the ISO week number of the year for a given date

Converts a serial number to a minute

Converts a serial number to a month

Returns the number of whole workdays between two dates

NETWORKDAYS.INTL function

Returns the number of whole workdays between two dates using parameters to indicate which and how many days are weekend days

Returns the serial number of the current date and time

Converts a serial number to a second

Returns the serial number of a particular time

Converts a time in the form of text to a serial number

Returns the serial number of today’s date

Converts a serial number to a day of the week

Converts a serial number to a number representing where the week falls numerically with a year

Returns the serial number of the date before or after a specified number of workdays

WORKDAY.INTL function

Returns the serial number of the date before or after a specified number of workdays using parameters to indicate which and how many days are weekend days

Converts a serial number to a year

Returns the year fraction representing the number of whole days between start_date and end_date

Important: The calculated results of formulas and some Excel worksheet functions may differ slightly between a Windows PC using x86 or x86-64 architecture and a Windows RT PC using ARM architecture. Learn more about the differences.

Источник

DATE function

Use Excel’s DATE function when you need to take three separate values and combine them to form a date.

The DATE function returns the sequential serial number that represents a particular date.

The DATE function syntax has the following arguments:

Year Required. The value of the year argument can include one to four digits. Excel interprets the year argument according to the date system your computer is using. By default, Microsoft Excel for Windows uses the 1900 date system, which means the first date is January 1, 1900.

Tip: Use four digits for the year argument to prevent unwanted results. For example, «07» could mean «1907» or «2007.» Four digit years prevent confusion.

If year is between 0 (zero) and 1899 (inclusive), Excel adds that value to 1900 to calculate the year. For example, DATE(108,1,2) returns January 2, 2008 (1900+108).

If year is between 1900 and 9999 (inclusive), Excel uses that value as the year. For example, DATE(2008,1,2) returns January 2, 2008.

If year is less than 0 or is 10000 or greater, Excel returns the #NUM! error value.

Month Required. A positive or negative integer representing the month of the year from 1 to 12 (January to December).

If month is greater than 12, month adds that number of months to the first month in the year specified. For example, DATE(2008,14,2) returns the serial number representing February 2, 2009.

If month is less than 1, month subtracts the magnitude of that number of months, plus 1, from the first month in the year specified. For example, DATE(2008,-3,2) returns the serial number representing September 2, 2007.

Day Required. A positive or negative integer representing the day of the month from 1 to 31.

If day is greater than the number of days in the month specified, day adds that number of days to the first day in the month. For example, DATE(2008,1,35) returns the serial number representing February 4, 2008.

If day is less than 1, day subtracts the magnitude that number of days, plus one, from the first day of the month specified. For example, DATE(2008,1,-15) returns the serial number representing December 16, 2007.

Note: Excel stores dates as sequential serial numbers so that they can be used in calculations. January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,447 days after January 1, 1900. You will need to change the number format (Format Cells) in order to display a proper date.

For example: =DATE(C2,A2,B2) combines the year from cell C2, the month from cell A2, and the day from cell B2 and puts them into one cell as a date. The example below shows the final result in cell D2.

Need to insert dates without a formula? No problem. You can insert the current date and time in a cell, or you can insert a date that gets updated. You can also fill data automatically in worksheet cells.

Right-click the cell(s) you want to change. On a Mac, Ctrl-click the cells.

On the Home tab click Format > Format Cells or press Ctrl+1 (Command+1 on a Mac).

3. Choose the Locale (location) and Date format you want.

For more information on formatting dates, see Format a date the way you want.

You can use the DATE function to create a date that is based on another cell’s date. For example, you can use the YEAR, MONTH, and DAY functions to create an anniversary date that’s based on another cell. Let’s say an employee’s first day at work is 10/1/2016; the DATE function can be used to establish his fifth year anniversary date:

The DATE function creates a date.

The YEAR function looks at cell C2 and extracts «2012».

Then, «+5» adds 5 years, and establishes «2017» as the anniversary year in cell D2.

The MONTH function extracts the «3» from C2. This establishes «3» as the month in cell D2.

The DAY function extracts «14» from C2. This establishes «14» as the day in cell D2.

If you open a file that came from another program, Excel will try to recognize dates within the data. But sometimes the dates aren’t recognizable. This is may be because the numbers don’t resemble a typical date, or because the data is formatted as text. If this is the case, you can use the DATE function to convert the information into dates. For example, in the following illustration, cell C2 contains a date that is in the format: YYYYMMDD. It is also formatted as text. To convert it into a date, the DATE function was used in conjunction with the LEFT, MID, and RIGHT functions.

The DATE function creates a date.

The LEFT function looks at cell C2 and takes the first 4 characters from the left. This establishes “2014” as the year of the converted date in cell D2.

The MID function looks at cell C2. It starts at the 5th character, and then takes 2 characters to the right. This establishes “03” as the month of the converted date in cell D2. Because the formatting of D2 set to Date, the “0” isn’t included in the final result.

The RIGHT function looks at cell C2 and takes the first 2 characters starting from the very right and moving left. This establishes “14” as the day of the date in D2.

To increase or decrease a date by a certain number of days, simply add or subtract the number of days to the value or cell reference containing the date.

In the example below, cell A5 contains the date that we want to increase and decrease by 7 days (the value in C5).

Источник

DATEVALUE function

This article describes the formula syntax and usage of the DATEVALUE function in Microsoft Excel.

Description

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. Remember, though, that your computer’s system date setting may cause the results of a DATEVALUE function to vary from this example

The DATEVALUE function is helpful in cases where a worksheet contains dates in a text format that you want to filter, sort, or format as dates, or use in date calculations.

To view a date serial number as a date, you must apply a date format to the cell. Find links to more information about displaying numbers as dates in the See Also section.

Syntax

The DATEVALUE function syntax has the following arguments:

Date_text Required. Text that represents a date in an Excel date format, or a reference to a cell that contains text that represents a date in an Excel date format. For example, «1/30/2008» or «30-Jan-2008» are text strings within quotation marks that represent dates.

Using the default date system in Microsoft Excel for Windows, the date_text argument must represent a date between January 1, 1900 and December 31, 9999. The DATEVALUE function returns the #VALUE! error value if the value of the date_text argument falls outside of this range.

If the year portion of the date_text argument is omitted, the DATEVALUE function uses the current year from your computer’s built-in clock. Time information in the date_text argument is ignored.

Excel stores dates as sequential serial numbers so that they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,447 days after January 1, 1900.

Most functions automatically convert date values to serial numbers.

Example

Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter. If you need to, you can adjust the column widths to see all the data.

Источник

DATEVALUE Function

Converts imported dates from text to proper date format

What is the DATEVALUE Function?

The DATEVALUE Function[1] is categorized under Excel Date/Time functions.

When doing financial analysis, we often need to import files from another source, which can be in PDF, text, or csv file format. The DATEVALUE function helps convert dates imported from external sources that are in text format to a proper date format recognizable by Excel for further analysis.

Formula

=DATEVALUE(date_text)

The DATEVALUE function includes the following arguments:

Date_text – This is a required argument. It is the text that represents a date in an Excel date format, or a reference to a cell that contains text that represents a date in an Excel date format. For example, “1/30/2017” or “30-Jan-2017” are text strings within quotation marks that represent dates.

How to use the DATEVALUE Function in Excel?

To understand the uses of this function, let’s consider a few examples:

Example 1

Suppose we have been given following dates in text format. We shall use this function to convert the different text representations of dates given to us.

The DATEVALUE function in Excel, when interpreting the supplied date_text argument, follows simple rules to interpret the year. The rules are:

  • When we provide just a date and month, then the returned date will return the current year. This function will take the current year from the computer’s system clock.
  • For this function, the default settings for the year are the one- and two-digit years interpreted as follows:
    • The numbers 0 through to 29 are interpreted as the years 2000 to 2029;
    • The numbers 30 through to 99 are interpreted as the years 1930 to 1999.

As seen above, when we provide 01/01/30, this function interpreted it as 1930. The results, as shown above, are returned as numbers due to the “General” formatting type. So, the results displayed above show the underlying numeric value for the resulting dates. We need to change the formatting to DATE to get dates in the result column. For this, we can select the cell or range of cells and, on the Home tab, click on number format and select Date instead of Number, as shown below:

The other way to do it is to select a cell or a range of cells with the numbers that we want to convert to dates and then press Ctrl+1 to open the Format Cells dialog. On the Number tab, choose Date and select the desired date format under Type and click OK.

The result we get is as follows:

Example 2

Taking the same dates in the example above, we added the time factor to them as shown below:

Let’s see how this function behaves in such a scenario. The formula used is DATEVALUE(A1). The results are shown below:

As we can see, this function ignores the time information in text strings. If we wish to convert text values containing both dates and times, we need to use the VALUE function.

Example 3

Let’s assume that while importing the data from a PDF, we obtained the dates in the following format:

Using the DATEVALUE function, we can combine the above data to get a single date in a cell. The formula to be used is =DATEVALUE(A2 & “/” & B2 & “/” & C2) as shown below:

We get the result below:

We can format the result in date format to get the result as:

Notes about the DATEVALUE Function

  1. #NUM! error – Occurs when the start_date is greater than the end_date.
  2. #VALUE! Error – Occurs when the value of the date_text argument falls outside of the range January 1, 1900 and December 31, 9999.

Additional Resources

Thanks for reading CFI’s guide to important Excel functions! By taking the time to learn and master these functions, you’ll significantly speed up your financial analysis. To learn more, check out these additional CFI resources:

Источник

Bottom line: With Valentine’s Day rapidly approaching I thought it would be good to explain how you can get a date with your Excel skills.  Just kidding! 🙂  This post and video explain how the date calendar system works in Excel.

Skill level: Beginner

Learn How Dates Work in Excel

Dates in Excel can be just as complicated as your date for Valentine’s Day.  We are going to stick with dates in Excel for this article because I’m not qualified to give any other type of dating advice. 🙂

Video Tutorial on How Dates Work in Excel

The following is a video from The Ultimate Lookup Formulas Course on how the date system works in Excel.

Watch the Video on YouTube

There are over 100 short videos just like the one above included in the Ultimate Lookup Formulas Course.

This course has been designed to help you master Excel’s most important functions and formulas in an easy step-by-step manner.

The Ultimate Lookup Formulas course is now part of our comprehensive Elevate Excel Training Program.

Click Here to Learn More About Elevate Excel

What is a Date in Excel?

I should first make it clear that I am referring to a date that is stored in a cell.

The dates in Excel are actually stored as numbers, and then formatted to display the date.  The default date format for US dates is “m/d/yyyy” (1/27/2016).

Excel Dates Are Stored as Serial Numbers and Formatted as Dates

The dates are referred to as serial numbers in Excel.  You will see this in some of the date functions like DAY(), MONTH(), YEAR(), etc.

Date Functions Have a Serial Number Argument for a Date Value

So then, what is a serial number?  Well let’s start from the beginning.

The date calendar in Excel starts on January 1st, 1900.  As far as Excel is concerned this day starts the beginning of time.

Each Day is a Whole Number

Each day is represented by one whole number in Excel.  Type a 1 in any cell and then format it as a date.  You will get 1/1/1900.  The first day of the calendar system.

Type a 2 in a cell and format it as a date.  You will get 1/2/1900, or January 2nd.  This means that one whole day is represented by one whole number is Excel.

Excels Date System Starts on January 1st 1900

You can also take a cell that contains a date and format it as a number.

For example, this post was published on 1/27/2016.  Put that number in a cell (the keyboard shortcut to enter today’s date is Ctrl+;), and then format it as a number or General.

You will see the number 42,396.  This is the number of days that have elapsed since 1/1/1900.

Keyboard Shortcut to Enter Todays Date Excel Ctrl Semicolon

Date Based Calculations

It is important to know that dates are stored as the number of days that have elapsed since the beginning of Excel’s calendar system (1/1/1900).

When you calculate the difference between two dates by subtraction, the result will be the number of days between the two dates.

Calculate the Difference Between Two Dates in Excel - Returns Number of Days

1/27/2016 – 1/1/2016 = 26 days

6/30/2016 – 1/1/2016 = 181 days

There are a lot of Date functions in Excel that can help with these calculations.  Last week we learned about the DAY function for month-to-date calculations with pivot tables.

Ust the DAY Function to Return Day of Month in the Pivot Table Source Data

We won’t go into all the date functions here, but understanding that the serial number represents one day will give you a good foundation for working with dates.

What About Dates with Times?

Do you ever work with dates that contain time values?

These dates are still stored as serial numbers in Excel.  When you convert the date with a time to the number format, you will see a decimal number.

This decimal is a fraction of the day.

The Time Value is Stored as a Fraction of the Serial Number Day

One hour in Excel is represented by the number: 1/24 = 0.04167

One minute in Excel is represented by the number: 1/(24*60) = 1/1440 = 0.000694

So 8:30 AM can be calculated as: (8 * (1/24)) + (30 * (1/1440)) = .354167

An easier way to calculate this is by typing 8:30 AM in a cell, then changing the format to Number.

So if you are running a half hour late and want to let your boss know, text him/her and say you will be there at 0.354167. 🙂

Checkout my article on 3 ways to group times in Excel for more date time based calculations.

Don’t Talk About Excel Dates with Your Date

Unless your Valentine shares a similar passion for Excel, I strongly recommend NOT sharing this information on your date.

I remember the first time I met my wife, and told her I worked in finance.  The first word out of her mouth was, “BORING!”.  Awe… it was love at first sight… LOL 🙂

But you should now be able to use Excel to determine how many days it has been since you last spoke to your date.  That’s the only dating advice I can give.

Please leave a comment below with any questions on Excel dates.  Thanks!

The DATEVALUE function serves a simple purpose. It converts a date written as a text string into a serial number that Excel can recognize. While it looks (and indeed is) pretty straightforward, the DATEVALUE function provides powerful ammunition for converting dates, which consequently enables us to manipulate them with formulas and pivot tables.

This is especially helpful when you are importing data from external sources because it is quite likely that Excel will convert date entries into text strings upon importing. To remedy this, we will use the Excel DATEVALUE function and convert the text strings into Excel-recognized serial numbers representing dates.

DATEVALUE Function

Syntax

The syntax of the DATEVALUE function is as follows:

=DATEVALUE("date_text")

Arguments:

date_text – This is the only argument required. The supplied value should be a text string containing a valid date.

Before we dive deeper, let’s address a fundamental concept that forms the basis of the DATEVALUE function.

How does Excel store dates internally?

Since dates can be written in several formats, there has to be some sort of standardization that is understandable across worksheets. If you try to manipulate two dates in a worksheet, one with a DD/MM/YYYY format and another with MM/DD/YYYY format – will it still work? Yes! Because Excel stores these dates as a serial number.

This is precisely where the DATEVALUE function enters the scene. If you have dates enlisted in a column as text strings (not dates as far as Excel can tell), you will need the DATEVALUE function to convert those into serial numbers, so Excel knows that these are dates and not just text strings.

Important characteristics of the DATEVALUE function

  • The date_text argument must always be enclosed in quotes unless supplied as a cell reference.
  • If the referenced cell does not contain a date that is formatted as a text string, the formula will return a #VALUE! error.
  • If you do not use a 4 digit number for a year in a date, Excel will make the following assumption:
    • Entered number lies between 0 and 29: Excel will assume the year as 2000 to 2029.
    • Entered number lies between 30 and 99: Excel will assume the year as 1930 to 1999.
  • If you do not enter a year altogether, Excel will default to the current year as reflected in your computer’s time and date setup.

Examples of the DATEVALUE function

Now let’s have a look at some of the examples of the DATEVALUE function in Excel.

Example 1 – The plain-vanilla DATEVALUE formula

Let’s start by looking at the DATEVALUE formula in its simplest form. We have a list of dates written as a text string, and we need that converted into serial numbers that Excel can appropriately interpret as dates. To accomplish this, we will use the following formula:

=DATEVALUE(A2)

DATEVALUE_FUNCTION_EXAMPLE-001

Note that we could have just as well used a text string like “05-20-2005” instead of referencing the cell and achieved the same result.

In our example, we first use the formula to fetch the serial number of the dates. Once we have the serial numbers, all we need to do is change the cell format to “Short Date” or “Long Date” depending on your preference. You can select the format from the drop-down menu in the “Number” group under the “Home” tab in Excel.

Example 2 – DATEVALUE function with Imported Data

Let’s say you pulled the data set off a website, and you now have that data in a PDF or CSV format.

You import the data set into Excel, and it gives you a separate column for each component of a date (month, day, and year).

What you want is a date that Excel recognizes so that you can plug that in or reference it anywhere on your worksheet.

To deal with this, we will use the following formula:

=DATEVALUE(CONCAT(A2, "/",B2, "/", C2))

DATEVALUE_FUNCTION_EXAMPLE-002

In the above formula, we have used the CONCAT function to combine the different parts of the date and then passed the result to the DATEVALUE function. It’s that simple!

Example 3 – DATEVALUE function combined with TIMEVALUE function

Scroll back up to our first example and look at the image. Do you see how the last row includes time, but the formula ignores it and returns just the date?

Well, what if time was a critical component of my data? What if I also want to include time in my return?

To do this, we have to use the TIMEVALUE function along with the DATEVALUE function. DATEVALUE function only fetches the date part from the input string even though the input string has the date as well as time. On the other hand, the TIMEVALUE function takes only the time part from the supplied DateTime.

We can combine both these functions as:

=DATEVALUE(A2)+TIMEVALUE(A2)

DATEVALUE_FUNCTION_EXAMPLE-003

In the first part of the formula, we are extracting the date from the text string, with the help of DATEVALUE function. Using the same logic, in the second part of the formula, we are fetching the time from the text string.

By adding both these parts we are left with a decimal number, where the part before decimal represents the DATE in numeric format and the part after decimal represents the TIME in numeric format.

Be sure to format the output cells appropriately, so they show the date as well as the time.

Recommended Reading: Remove Time From Date In Excel

Not sure how to format cells for the DATEVALUE function?

Take a deep breath, we have you covered.

We know that Excel stores a date as a serial number, and for the same reason, the DATEVALUE function will always return a serial number.

To display it as a date, we must format that cell to show our preferred date format. When you have a serial number in a cell, right-click on the cell and choose “Format Cells”.

Format-cells-image-04

That should open up the following dialog box:

Format-cells-image-05

That is pretty much it. All you have to do now is choose your preferred format. If you want to display the time, be sure to choose a format that includes the time component.

That wraps up our discussion on the DATEVALUE function. I hope the next time you see an overwhelmingly long list of dates imported as text, you will know how to use the DATEVALUE function to deal with it. When you finish practicing, come back here, and we will talk about a new Excel function.

Понравилась статья? Поделить с друзьями:
  • What is excel and visual basic
  • What is excel 97 2003 workbook
  • What is excel 365
  • What is excel 2010 starter
  • What is etymology of the word science