Easy Excel Formula to Get Day from Date

Sharing is caring!

When working withΒ Excel, it’s common to handle dates and extract specific components, such as theΒ day. Whether you’re creating reports or analyzing data, knowing how to pull the day from a date can save time and enhance accuracy. In this article, we’ll walk you through variousΒ Excel formulasΒ and methods to retrieve the day from a date, making your work more efficient.

Understanding Excel Date Formats

Dates inΒ ExcelΒ are stored as serial numbers, with theΒ day, month, and yearΒ being part of this numeric value. Excel automatically converts entered dates into a numerical format. For example, January 1, 1900, is represented asΒ 1, and January 2, 1900, is represented asΒ 2.

Before extracting the day, it’s essential to ensure the date data is correctly formatted. Excel offers built-in tools to change and customize date formats, but understanding the underlying serial number system is key to using formulas effectively.

Basic Formula to Extract Day from a Date

TheΒ DAYΒ function in Excel is the most straightforward way to retrieve the day from a date. TheΒ DAY functionΒ returns the day as a number from a date in the format ofΒ 1-31, depending on the date.

Syntax of the DAY Function

=DAY(serial_number)
  • serial_number: This is the date from which you want to extract the day.

Example

If you have a date inΒ cell A2, you can use the following formula to get the day:

=DAY(A2)

Result

If the date in A2 isΒ 15/09/2023, the result will beΒ 15.

Using TEXT Function to Get Day from Date

TheΒ TEXT functionΒ is another versatile method to get the day from a date, especially when you want the day displayed in a particular format. This function is often used to format dates or numbers as text strings.

Syntax of the TEXT Function

=TEXT(value, format_text)
  • value: The date or cell reference containing the date.
  • format_text: The format in which you want the day displayed.

Example 1: Getting Day Number

To extract the day number, you can use:

=TEXT(A2, "D")

This will return theΒ dayΒ of the date as a number, similar to theΒ DAYΒ function.

Example 2: Getting Day Name (Short Format)

To extract theΒ day nameΒ (e.g., β€œMon,” β€œTue”), you can use:

=TEXT(A2, "DDD")

If A2 has the dateΒ 15/09/2023, this formula will returnΒ β€œFri”.

Example 3: Getting Day Name (Full Format)

To display the full day name (e.g., β€œMonday,” β€œTuesday”), use:

=TEXT(A2, "DDDD")

For the same dateΒ 15/09/2023, this will returnΒ β€œFriday”.

Table Example for Different Formats

DateFormulaResult
15/09/2023=DAY(A2)15
15/09/2023=TEXT(A2, "D")15
15/09/2023=TEXT(A2, "DDD")Fri
15/09/2023=TEXT(A2, "DDDD")Friday

Custom Formatting to Display Day from Date

Instead of using formulas, you canΒ custom formatΒ your cells to display just the day or the day name from a full date. This method is helpful when you want to visually change the appearance of a date without altering the underlying data.

Steps to Custom Format a Date

  1. Select the date cellsΒ you want to format.
  2. Right-click and chooseΒ Format Cells.
  3. In the Format Cells dialog box, click on theΒ NumberΒ tab.
  4. ChooseΒ CustomΒ from the list.
  5. In theΒ TypeΒ field, enter one of the following custom codes:
    • β€œD”: For the day as a number (e.g., 15)
    • β€œDDD”: For the day name (short form, e.g., β€œMon”)
    • β€œDDDD”: For the full day name (e.g., β€œMonday”)
  6. ClickΒ OK.

Example of Custom Formatting

If you have the dateΒ 15/09/2023Β in a cell, applying theΒ β€œDDD” format will displayΒ β€œFri”, while applying theΒ β€œDDDD” format will showΒ β€œFriday”.

Extracting Day from Date Using Other Formulas

Beyond theΒ DAYΒ andΒ TEXTΒ functions, there are other Excel formulas that can help you manipulate dates and extract day information depending on your needs.

Using the WEEKDAY Function

TheΒ WEEKDAY functionΒ returns a number corresponding to the day of the week for a given date, where Sunday isΒ 1Β and Saturday isΒ 7.

Syntax of the WEEKDAY Function

=WEEKDAY(serial_number, [return_type])
  • serial_number: The date you want to analyze.
  • return_type: Optional. Specifies the day on which the week starts. UseΒ 1Β for a week starting on Sunday, orΒ 2Β for a week starting on Monday.

Example

For the dateΒ 15/09/2023Β in cell A2:

=WEEKDAY(A2, 2)

This will returnΒ 5, indicating that the date is aΒ FridayΒ (where Monday isΒ 1Β and Sunday isΒ 7).

Using the CHOOSE Function with WEEKDAY

You can combine theΒ WEEKDAYΒ function with theΒ CHOOSEΒ function to return the day name directly.

=CHOOSE(WEEKDAY(A2,2), "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun")

This formula returns theΒ name of the dayΒ for a given date, whereΒ WEEKDAYΒ helps identify the day number andΒ CHOOSEΒ returns the corresponding day name.

Combining IF and DAY Functions

You might need to perform conditional operations based on the day extracted from a date. TheΒ IFΒ function can be combined with theΒ DAYΒ function to return specific results depending on the day.

Example

Suppose you want to check if a date falls on theΒ first dayΒ of the month. You can use:

=IF(DAY(A2)=1, "First Day", "Not First Day")

If the date in A2 isΒ 01/09/2023, the formula will returnΒ β€œFirst Day”. Otherwise, it will returnΒ β€œNot First Day”.

How to Extract Day from Date Using VBA

If you’re comfortable usingΒ VBA (Visual Basic for Applications)Β in Excel, you can create aΒ macroΒ to extract the day from a date.

Example VBA Code

Function GetDayFromDate(dateValue As Date) As Integer
    GetDayFromDate = Day(dateValue)
End Function

This custom function allows you to enter a date and receive the day directly.

Summary of Common Excel Formulas to Get Day from Date

Here’s a summary table of common formulas used to extract theΒ dayΒ orΒ day nameΒ from a date:

FunctionDescriptionExample FormulaResult
DAYReturns day number (1-31)=DAY(A2)15
TEXTReturns day as text or number=TEXT(A2, "DDD")Fri
WEEKDAYReturns the day of the week as a number (1-7)=WEEKDAY(A2, 2)5 (Friday)
CHOOSE & WEEKDAYReturns day name using CHOOSE & WEEKDAY=CHOOSE(WEEKDAY(A2,2), "Mon",...)Friday
IF & DAYConditional check based on day number=IF(DAY(A2)=1, "First Day", "...")Not First Day

Final Thoughts

Mastering how to extract theΒ dayΒ from a date in Excel provides more control over your data analysis and reporting. Whether you use theΒ DAY function, theΒ TEXT function, or other formulas likeΒ WEEKDAY, each approach offers flexibility depending on your needs. Combining these functions with Excel’s powerful formatting options allows you to display date-related information in a way that suits your project or report.

FAQs

How do I get the day from a date in Excel?

You can use the DAY function to extract the day number from a date. The formula is =DAY(A2), where A2 is the cell with the date.

Can I display the full day name in Excel from a date?

Yes, you can use the TEXT function to display the full day name. Use the formula =TEXT(A2, β€œDDDD”) to display the full day name like β€˜Monday’.

How can I get the short day name from a date?

You can use the TEXT function with the format code β€˜DDD’ to get the short day name. For example, use =TEXT(A2, β€œDDD”) to get β€˜Mon’ for Monday.

What is the difference between the DAY and TEXT functions?

The DAY function extracts the day number (1-31) from a date, while the TEXT function can extract the day and display it in various formats, including the day name.

How can I find the weekday number in Excel?

You can use the WEEKDAY function to find the weekday number, where Sunday is 1 and Saturday is 7. For example, use =WEEKDAY(A2, 2) to start the week on Monday.

Can I create a custom function to get the day from a date using VBA?

Yes, you can use VBA to create a custom function. The code would be: Function GetDayFromDate(dateValue As Date) As Integer. This allows you to return the day number from a date.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *