Why EOMONTH Needs a Double Unary with Excel Arrays
Question details
The user wants to understand why the EOMONTH function in Excel requires a double unary operator (--) when processing array values, and how to apply it to resolve array formula errors.

- Product
- Spreadsheets
- Device & OS
- not provided
- Scenario
- Using the EOMONTH function within an array formula that contains text-formatted dates or logical values, which causes calculation errors.
- Observed behavior
- The formula engine fails to process the array values automatically as numbers, requiring a double unary operator to coerce the text or logical data into numerical serial dates before EOMONTH can evaluate them.
Ensure your array data contains valid date strings or logical values that can actually be converted into numeric date serial numbers, and verify if your spreadsheet software version supports dynamic arrays.
Apply the Double Unary Operator (--) to Coerce Array Values
Use a double negative operator to force the formula engine to convert text-formatted dates or logical values within an array into numeric serial numbers that the EOMONTH function can process.
The EOMONTH function strictly expects numeric inputs to represent dates. When you feed it an array generated from logical tests (TRUE/FALSE) or text strings, the formula engine might not automatically convert these non-numeric data types. The double unary operator (--) essentially multiplies the values by -1 twice, a mathematical operation that safely forces this conversion into numeric values without altering the underlying result.
Click on the cell or range of cells where you want the end-of-month dates to be displayed.
Type your EOMONTH formula, placing the double unary operator (--) immediately before the array argument. For example, enter =EOMONTH(--A2:A10, 0).
If you are using a legacy version of Excel, press Ctrl + Shift + Enter to evaluate the formula as an array. In modern software with dynamic arrays, simply press Enter.
Because EOMONTH returns serial numbers, highlight the resulting output cells, right-click, select 'Format Cells', and apply a 'Date' format to view the results correctly.
Update to Modern Dynamic Array Formulas
Ensure you are using a modern spreadsheet version that supports dynamic arrays natively, which handles many implicit coercions and spilling behaviors better than legacy array formulas.
Easily Handle Array Formulas with WPS Spreadsheets
WPS Spreadsheets provides robust support for advanced array formulas, modern dynamic arrays, and date functions like EOMONTH, ensuring seamless data coercion and high compatibility with your existing workbooks.
- 1. Open your file in WPS Spreadsheets: Launch WPS Office and open the workbook containing your date arrays.
- 2. Apply the double unary operator: Click on the target cell and type =EOMONTH(--[Your_Array_Range], [Months]).
- 3. Execute the formula: Press Enter to calculate. WPS Spreadsheets' advanced engine will automatically process the double unary coercion.
- 4. Format the results: Highlight the calculated cells, right-click, choose 'Format Cells', and select your preferred Date format.

Frequently Asked Questions
What exactly does the double unary operator (--) do in formulas?
The double unary operator consists of two minus signs. It performs a quick mathematical operation (multiplying by -1 twice) that converts text-represented numbers, dates, or boolean values (TRUE/FALSE) into actual numeric values (like 1/0 or date serial numbers) that spreadsheet functions can properly process.
Why am I getting a #VALUE! error with the EOMONTH function?
The #VALUE! error in EOMONTH typically occurs when the provided start_date argument is not recognized as a valid date or number. If you are passing an array of text-formatted dates, adding the double unary operator (--) before the array usually fixes this by forcing a numeric conversion.
Do I still need to use Ctrl+Shift+Enter for EOMONTH array formulas?
If you are using legacy spreadsheet software (like Excel 2019 or earlier), you must press Ctrl+Shift+Enter to evaluate array formulas. In modern software like Microsoft 365, Excel 2021, and recent versions of WPS Office, dynamic arrays process automatically when you simply press Enter.




