Fix an Excel Custom Function Returning Incorrect Totals in Microsoft 365
Question details
Restore the correct result from an Excel VBA custom function that sums a range while excluding cells formatted with strikethrough.

- Product
- Microsoft Excel for Microsoft 365
- Device & OS
- Windows and macOS
- Scenario
- A shared XLSM workbook contains a custom function that previously worked on staff members' Windows computers and the author's Mac.
- Observed behavior
- The custom function still exists, but it no longer returns the correct total. The initial report that macros had disappeared was later corrected.
Identify one formula cell with an incorrect result and calculate its expected total manually, excluding the struck-through values. Confirm whether the strikethrough was applied directly through Format Cells or through conditional formatting.
Confirm the workbook format and locate the custom function
Use this check to distinguish missing VBA code from an existing function that produces an incorrect result.
Check the workbook's filename or open File > Save As to inspect its file type. A macro-enabled workbook should use .xlsm, and a macro-enabled template should use .xltm. Saving as .xlsx does not preserve VBA code.
Open Developer > Visual Basic and expand the workbook's project and Modules folder. Locate the Function procedure used by the worksheet formula. Developer > Macros lists runnable macros, but worksheet custom functions generally do not appear there.
Select the cell with the incorrect total and inspect its formula in the formula bar. Confirm that the function name matches the VBA Function procedure and that its range argument includes the intended cells.
Test strikethrough detection and recalculate the custom function
Use this solution when the VBA function exists but includes excluded cells or returns a stale total.
Compare Excel builds and reproduce the issue on Windows and Mac
Use this check if the same workbook began returning incorrect results on multiple computers around the same time.
Use WPS Spreadsheet for a Formula-Based Exclusion Total
WPS Office is a free, lightweight alternative with a familiar spreadsheet interface and Microsoft Office format compatibility for easy migration of standard files. For this task, use an explicit inclusion column and SUMIF instead of depending on strikethrough formatting. WPS does not repair an Excel VBA function; verify macro support before moving a VBA-dependent workbook.

Frequently Asked Questions
Why is my custom function missing from Developer > Macros?
The Macros dialog generally lists runnable Sub procedures, not worksheet Function procedures. Open Developer > Visual Basic and look in the workbook's Modules folder for the function used in your formula.
Why does applying strikethrough not update my total?
Formatting changes do not normally trigger recalculation. Select the custom-function formula, click it in the formula bar, and press Enter to reevaluate it. If that fixes the result, consider using a separate inclusion column so changes become calculation inputs.
Can Font.Strikethrough detect strikethrough from conditional formatting?
Font.Strikethrough checks the cell's direct font formatting, not necessarily the appearance produced by conditional formatting. Open Home > Conditional Formatting > Manage Rules to inspect the rule, then base the calculation on that rule's condition.
How can I sum included rows without VBA?
Enter amounts in A2:A100 and mark included rows with Include in B2:B100. In the total cell, enter =SUMIF(B2:B100,"Include",A2:A100). You can still apply strikethrough for visual reference, but the status column determines the total.
Does saving the workbook as XLSM fix an incorrect function result?
No. The .xlsm format preserves existing VBA code, but it does not correct the function's logic or recalculation behavior. If the code is present in Developer > Visual Basic, test its range, strikethrough check, and calculation behavior.





