How to Display N/A for Blank Date Cells Using Excel Formulas
Question details
The user wants a formula to display "N/A" when either of two date cells is empty, and to calculate the date difference only when both cells have valid dates.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Calculating the difference between two dates dynamically while preventing incorrect calculations or errors when one or both dates are missing.
- Observed behavior
- Instead of returning an error or calculating an invalid date difference, the target cell accurately displays "N/A" when a date is missing.
Verify that your date cells are properly formatted as Date or Numeric values, as the COUNT function specifically looks for numbers and will ignore text strings.
Use the IF and COUNT Functions
Combine the IF and COUNT functions to verify both cells contain numbers (dates) before executing the subtraction.
The COUNT function tallies the number of numeric values within a range. Because Excel treats dates as serial numbers, COUNT will return 2 if both date cells are properly filled. The IF function then uses this condition to determine whether to subtract the dates or output "N/A".
Click on the cell where you want the date difference or "N/A" to be displayed (for example, E4).
Type the formula =IF(COUNT(C4:D4)<2,"n/a",D4-C4) into the formula bar.
Press Enter to apply the formula. Click and drag the small square fill handle at the bottom-right corner of the cell to copy the formula down to the rest of your column.
Use the IF, OR, and ISBLANK Functions
Explicitly check if either of the target cells is blank to trigger the "N/A" output.
Calculate Date Differences Seamlessly with WPS Spreadsheet
WPS Spreadsheet fully supports all advanced logical and statistical formulas, including IF, COUNT, and ISBLANK. You can easily manage complex datasets and automate your workflow with high accuracy.
- 1. Open your workbook: Launch WPS Spreadsheet and open the document containing your date columns.
- 2. Apply the logic formula: Select an empty cell and input =IF(COUNT(A1:B1)=2,B1-A1,"N/A"), replacing A1 and B1 with your actual date cell references.
- 3. Drag to fill: Press Enter, then double-click the fill handle to automatically apply this rule to the entire column.

Frequently Asked Questions
Why does my formula return a #VALUE! error instead of N/A?
This usually occurs if one of the cells contains text or spaces rather than being completely blank or containing a valid date. Ensure your date cells are strictly formatted as Dates and clear any hidden space characters from "blank" cells.
Can I leave the cell completely blank instead of displaying 'n/a'?
Yes. To leave the cell blank when a date is missing, replace "n/a" in the formula with two double quotes (""). The formula will look like this: =IF(COUNT(C4:D4)<2,"",D4-C4).
Does this formula work for calculating working days?
Yes, but you need to replace the standard subtraction with the NETWORKDAYS function. The modified formula would be: =IF(COUNT(C4:D4)<2,"n/a",NETWORKDAYS(C4,D4)).




