Function Problems

Sum Odd Digits in an Excel Number With a Formula

Khadija KhanKhadija Khan Nov 22, 2026 869 views

Question details

Calculate the sum of the odd digits within a number using an Excel formula.

How to Sum Odd Digits in an Excel Number
Product
Microsoft Excel
Device & OS
not provided
Scenario
A number is entered in one cell, and its odd digits need to be added in another cell without VBA or an add-in.
Observed behavior
For the number 28975, the odd digits 9, 7 and 5 should total 21.
Before you start

Enter a nonnegative whole number such as 28975 in cell A1. Choose an empty cell for the result; the formula below uses B1.

Solution 1Recommended

Use SUMPRODUCT to add the odd digits

Use this formula to extract each digit from A1 and sum only those that are odd.

MID extracts each digit, MOD tests whether it is odd, and SUMPRODUCT adds the qualifying digits. This formula expects A1 to contain digits only, with no minus sign, decimal point or other characters.

1
Enter the number

Type 28975 in cell A1, or replace it with the nonnegative whole number you want to check.

2
Enter the formula

Select cell B1 and enter =SUMPRODUCT(MOD(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1),2)*MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)).

3
Check the result

Press Enter. For 28975, B1 displays 21 because 9 + 7 + 5 = 21.

Use SUMPRODUCT to add the odd digits
Using a different cell: B1 is only the suggested output cell. You can enter the formula in another empty cell; replace each A1 reference if your source number is elsewhere.
Calculate with WPS Spreadsheets

Sum odd digits in WPS Spreadsheets

Use the same SUMPRODUCT formula in WPS Spreadsheets to extract and add odd digits without VBA or an add-in.

  1. 1. Open a spreadsheet: Open WPS Office and choose Spreadsheets, then create or open a workbook.
  2. 2. Enter the source number: Type 28975 in cell A1.
  3. 3. Enter the formula: Select B1 and enter =SUMPRODUCT(MOD(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1),2)*MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)).
  4. 4. View the total: Press Enter and check that B1 displays 21.
Sum odd digits in a single cell with a formulaOpen and save Microsoft Excel XLSX filesUse familiar spreadsheet functions and a familiar interfaceWork with a free, lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

What does B1 refer to in the formula?

B1 is the suggested cell for the result; it is not referenced in the formula. A1 is the cell containing the source number.

Can I use a different source cell?

Yes. Replace every A1 reference in the formula with the cell containing your number, such as C2, and enter the formula in a different empty cell.

Why does the formula return an error for a negative or decimal number?

The formula examines each character, so a minus sign or decimal point is not a digit it can test with MOD. Use an input containing digits only.

Does this formula sum odd numbers in a range?

No. It sums odd digits within one cell. To sum odd whole numbers in A1:A10 instead, use =SUMPRODUCT((MOD(A1:A10,2)=1)*A1:A10).