Google Sheets: How to Use IF Function Based on Month


You can use the following formula to use an IF function based on a month in Google Sheets:

=IF(MONTH(A2)=10, B2, 0)

This particular formula checks if the month in the date of cell A2 is equal to 10 (the 10th month of the year), which is October.

If the month is October, then the formula returns the value in cell B2.

Otherwise, the formula simply returns a value of 0.

The following example shows how to use this formula in practice.

Example: Use IF Function Based on Month in Google Sheets

Suppose we have the following dataset in Google Sheets that shows the total sales made on various dates at some store:

Suppose we would like to use an IF function that returns the value of the sales if the date in column A is in October or a value of zero if the date is not in October.

We can type the following formula into cell C2 to do so:

=IF(MONTH(A2)=10, B2, 0)

The following screenshot shows how to use this formula in practice:

Google Sheets If month

If the date in column A is in October, then the formula returns the corresponding value in the sales column.

Otherwise, the formula simply returns a value of zero.

Note that you can also use multiple conditions within the IF function.

For example, you can use the following formula to return the value of the sales if the date in column A is in October or November, otherwise a value of zero:

=IF(OR(MONTH(A2)=10, MONTH(A2)=11), B2, 0)

The following screenshot shows how to use this formula in practice:

If the date in column A is in October or November, then the formula returns the corresponding value in the sales column.

Otherwise, the formula simply returns a value of zero.

Additional Resources

The following tutorials explain how to perform other common tasks in Google Sheets:

Google Sheets Formula: If Match then Return Yes or No
Google Sheets: How to Use SUBTOTAL with COUNTIF
Google Sheets: How to Use VLOOKUP with COUNTIF

Leave a Reply

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