Sub topic 12
Applying date formulas to whole columns
Prerequisites: you should know how to enter formulas, use relative and absolute cell references, and change number formats from the Format menu. You should also understand that Google Sheets stores real dates as numbers. A blank-looking cell may be empty, or it may contain text that only looks like a date.
Why use `ARRAYFORMULA`
A normal formula processes one row. ARRAYFORMULA lets one formula process a range and return one result for each row. This is useful when new records will be added regularly.
Suppose column A contains order dates, beginning in A2. Enter this formula in B2:
=ARRAYFORMULA(IF(A2:A="", "", EOMONTH(A2:A, 0)))For every nonblank date in column A, column B returns the last day of that date's month. The IF condition keeps empty rows empty instead of displaying a date or an error.
You can apply the same pattern to other date functions:
=ARRAYFORMULA(IF(A2:A="", "", YEAR(A2:A)))=ARRAYFORMULA(IF(A2:A="", "", WEEKDAY(A2:A, 2)))The first formula returns the year. The second returns a weekday number from 1 for Monday through 7 for Sunday.
A whole-column calculation pattern
Use this sequence when building a column formula:
- Identify the input range, such as
A2:A. - Wrap the date function in
ARRAYFORMULA. - Test for blank rows with
IF. - Format the output column as a date, number, or plain text according to the result.
The input values must be real dates. If a cell contains text such as 2026-11-28, YEAR or EOMONTH may fail until you convert it:
=ARRAYFORMULA(IF(A2:A="", "", EOMONTH(DATEVALUE(A2:A), 0)))Use this version only when the input is consistently parseable date text. If the column already contains date values, adding DATEVALUE is unnecessary.
Headers, errors, and performance
Place the formula below the header rather than including the header in the input range. For example, start with A2:A, not A1:A, when A1 contains Order date.
If malformed values may appear, show a controlled result:
=ARRAYFORMULA(IF(A2:A="", "", IFERROR(EOMONTH(A2:A, 0), "Check date")))An open-ended range such as A2:A is convenient, but many complex array formulas over several entire columns can slow a large sheet. If the dataset has a known maximum size, use a bounded range such as A2:A10000.
A formula that returns a date still needs date formatting. Formatting changes how the result appears; it does not change the stored date value.
Exercise
Column A contains dates beginning in A2. Write one formula in B2 that returns the first day of each date's month and leaves blank rows empty.
Show answer
=ARRAYFORMULA(IF(A2:A="", "", DATE(YEAR(A2:A), MONTH(A2:A), 1)))