# DAY

The `DAY` function is used to extract the day of the month from a given date. It takes in a single argument, a date in a valid format, and returns the day of the month as a number between 1 and 31. This function can be useful for tasks such as sorting or filtering data based on the day of the month.

## Usage

Use the `DAY` formula with the syntax shown below, it has 1 required parameter:

Parameters:
1. date (required):
The date from which to extract the day of the month. This argument must be in a valid date format, such as a cell reference or a date returned from another function. Dates can be entered as text surrounded by quotes or as serial numbers.

## Examples

Here are a few example use cases that explain how to use the `DAY` formula in Google Sheets.

### Count the number of sales made on a specific day

By using the `DAY` function to extract the day of the month from a date column, you can use a `COUNTIF` function to count the number of sales made on a specific day. For example, to count the number of sales made on the 15th of the month, use the formula `=COUNTIF(A2:A100, DAY("2022-01-15"))` where A2:A100 is the range of dates and "2022-01-15" is the date you want to count.

### Extract the day of the week from a date

By combining the `DAY` function with the `WEEKDAY` function, you can extract the day of the week from a date. For example, to get the day of the week for the date in cell A1, use the formula `=WEEKDAY(A1)`. This will return a number between 1 (Sunday) and 7 (Saturday).

### Calculate the number of days between two dates

By subtracting the result of the `DAY` function applied to two dates, you can calculate the number of days between them. For example, to calculate the number of days between the dates in cells A1 and B1, use the formula `=DAY(B1)-DAY(A1)`. Note that this will only work if the two dates are in the same month.

## Common Mistakes

`DAY` not working? Here are some common mistakes people make when using the `DAY` Google Sheets Formula:

### Incorrect date format

If the date provided in the DAY formula is not in the correct format, the formula will return an error. Make sure the date is formatted correctly or use the DATEVALUE function to convert it.

### Using a cell reference instead of a date

If you use a cell reference that contains a date in the DAY formula, make sure the cell is formatted as a date. If the cell is not formatted as a date, the formula will return an error or an incorrect result.

### Using a blank cell as input

If you use a blank cell as input in the DAY formula, it will return 0 as the result. To avoid this, use an IF statement to check if the cell is blank before using it in the formula.

### Not using parentheses in the formula

Make sure to use parentheses around the date in the DAY formula. If you don't use parentheses, the formula may not work correctly.

### Using a date that is not a valid date

If you use a date that is not a valid date in the DAY formula, it will return an error. Make sure the date is valid or use the IFERROR function to handle the error.

The following functions are similar to `DAY` or are often used with it in a formula:

• `MONTH`

The `MONTH` formula is used to extract the month from a given date, returning it as a number between 1 and 12. This function is commonly used to summarize and analyze data that includes dates.

• `YEAR`

The YEAR formula in Google Sheets returns the year of a specified date. This function is useful when you need to extract the year from a date for analysis or calculations. The YEAR formula takes one argument, which is the date from which to extract the year. The output is a four-digit number representing the year.

• `DATE`

The `DATE` formula is used to create a date object in Google Sheets. It takes three arguments: year, month, and day and returns a date. This formula is useful when you need to perform date calculations or create date-based charts and graphs.

• `TODAY`

The `TODAY` function returns the current date in the default timezone of the spreadsheet. The date is updated each time the spreadsheet is opened. This function is commonly used to calculate the current age or to track the number of days since a certain event, among other things.

You can learn more about the `DAY` Google Sheets function on Google Support.