Microsoft Tech Community - Latest Blogs - Excel Blog

السبت، 20 أغسطس 2022

Date Functions

 


Date Formulas

The most important thing to understand about dates is that Excel stores dates as serial numbers. The serial number represents the number of days from (the imaginary) day of 1/0/1900.

excel date serial number

You can find the number of days between two dates by simply subtracting the dates:

add subtract dates in Excel

You can also add or subtract days to a date:

add subtract days in Excel
1. Calculate the number of days from 11/29/2030 to 5/22/2041.(Hint)
Save Question to Custom Practice Set?

To return today's date, use the TODAY Function. There is no input required for the TODAY Function:

=today()

today-function-syntax

2. Calculate tomorrow’s date (Hint: add one to today’s date)
(Hint)
Save Question to Custom Practice Set?

DAY, MONTH, and YEAR Functions

The DAY, MONTH, and YEAR Functions return the day, month, and year of a given date. The only input required is a date. To calculate today's month:

=month(Today())

day-function-syntax

3. Calculate the day from cell B4.
(Hint)
Save Question to Custom Practice Set?

Date Function

The Date Function generates a date from a given year, month, and day.

=date(2019,5,20)

date-function-syntax

4. Generate the date 11/25/2030 using the Date Function.
(Hint)
Save Question to Custom Practice Set?

EDATE Function

The EDATE Function "rolls-forward" or "rolls-back" a date a certain number of months, returning the same day of the month as the original date. This is useful if you want to jump to the 1st, 15th, or other day in another month.

edate function example

When working with dates, you should always make use of smart date functions. Enter a date once and use formulas like EDATE to develop all other dates from that first date. This makes your spreadsheets easier to update and review!

edate-function-syntax

5. Roll-forward the date by 3 months.
(Hint)
Save Question to Custom Practice Set?

EDATE works great when working with the 1st or 15th of the month. However, It does not work well when dealing with the last day of the month because not every month has the same number of days. When working with the last day of the month, use EOMONTH instead

EOMONTH Function

The EOMONTH Function works similarily to the EDATE Function, except instead of returning the same day of the month as the input date, it will return the last day of the month. Let's look at some examples:

Return the last day of this month:

=eomonth(today(),0)

Return the first day of next month:

=eomonth(today(),0)+1

Return the first day of the current month:

=eomonth(today(),-1)+1

Your turn:

eomonth-function-syntax

6. Roll-forward the last day in Quarter 1 (cell C4) to the last day in Quarter 2 (3 months ahead).
(Hint)

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

إرسال تعليق