DAY Function – Get Day Number – Excel, VBA, Google Sheets
Written by
Reviewed by
Download the example workbook
This tutorial demonstrates how to use the Excel DAY Function in Excel to get the day of the month.
DAY Examples
The DAY Function returns the day number of a date:
=DAY(B3)
Day Number of Year
To calculate the day number of the year, subtract the first day of the year from your desired date. Do this by using the DATE and YEAR Functions:
=B3-DATE(YEAR(B3),1,1)+1
DAY and MONTH Functions
Using the DATE and DAY Functions you can build a new date using the same day number as the original date:
=DATE(2021,1,DAY(B3))
DAY in Google Sheets
The DAY Function works exactly the same in Google Sheets as in Excel:
DAY Examples in VBA
You can also use the DAY function in VBA. Type:
application.worksheetfunction.day(serial_number)
For the function arguments (serial_number, etc.), you can either enter them directly into the function, or define variables to use instead.