Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Time-Based Analysis | Excel Formulas
Excel Formulas

Time-Based Analysis

Swipe to show menu

Time-based reporting requires more than raw transaction dates. In this chapter, build dynamic monthly and year-to-date analytics that update automatically based on the current date.

Date Decomposition Functions

=MONTH(serial_number)
=YEAR(serial_number)
=TEXT(value, format_text)
  • MONTH(): returns the month number;
  • YEAR(): returns the year;
  • TEXT(): formats dates into readable labels.

TODAY Structure

=TODAY()

TODAY() returns the current system date dynamically.

EOMONTH Structure

=EOMONTH(start_date, months)
  • start_date: starting date;
  • months: number of months shifted forward or backward.

Formula used in this chapter:

=EOMONTH(TODAY(),-1)

This safely returns a valid date from the previous month, even across year boundaries.

Step 1 Validate the Date Column
expand arrow

Confirm that Sales_Data[Date] contains valid Excel date values instead of text strings.

Step 2 Create Helper Columns
expand arrow

Inside Sales_Data, create the following columns:

Month
Year
Month_Year

Inside the first row of each column, type:

=MONTH([@Date])
=YEAR([@Date])
=TEXT([@Date],"MMM YYYY")

The dataset now contains reusable time dimensions for analysis.

Step 3 Build Current Month Revenue
expand arrow

Type:

=SUMIFS(Sales_Data[Revenue],Sales_Data[Month],MONTH(TODAY()),Sales_Data[Year],YEAR(TODAY()))
  • MONTH(TODAY()): current month;
  • YEAR(TODAY()): current year.

The KPI now updates automatically as the calendar changes.

Step 4 Build Current Month Order Count
expand arrow

Type:

=COUNTIFS(Sales_Data[Month],MONTH(TODAY()),Sales_Data[Year],YEAR(TODAY()))

This counts all transactions from the current month and year.

Step 5 Build Previous Month Revenue
expand arrow

Type:

=SUMIFS(Sales_Data[Revenue],Sales_Data[Month],MONTH(EOMONTH(TODAY(),-1)),Sales_Data[Year],YEAR(EOMONTH(TODAY(),-1)))
  • EOMONTH(TODAY(),-1): previous month reference;
  • MONTH(...): previous month number;
  • YEAR(...): correct year context.

The formula remains stable across month and year transitions.

Step 6 Build Year-to-Date Revenue
expand arrow

Type:

=SUMIFS(Sales_Data[Revenue],Sales_Data[Year],YEAR(TODAY()),Sales_Data[Month],"<="&MONTH(TODAY()))
  • "<="&MONTH(TODAY()): dynamic comparison operator;
  • Includes all months up to the current month.
Step 7 Test Time Sensitivity
expand arrow

Add a transaction dated within the current month.

Confirm that:

  • Current month Revenue updates automatically;
  • Current month order count updates automatically;
  • Year-to-date Revenue updates automatically.

1. Why do we split dates into Month and Year helper columns?

2. Why is EOMONTH preferred over subtracting 1 from MONTH(TODAY())?

3. What does the expression "<="&MONTH(TODAY()) allow in YTD calculations?

question mark

Why do we split dates into Month and Year helper columns?

Select the correct answer

question mark

Why is EOMONTH preferred over subtracting 1 from MONTH(TODAY())?

Select the correct answer

question mark

What does the expression "<="&MONTH(TODAY()) allow in YTD calculations?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 1. Chapter 19

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

Section 1. Chapter 19
some-alt