Sum Odd Digits in an Excel Number With a Formula
Question details
Calculate the sum of the odd digits within a number using an Excel formula.

- 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.
Enter a nonnegative whole number such as 28975 in cell A1. Choose an empty cell for the result; the formula below uses B1.
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.
Type 28975 in cell A1, or replace it with the nonnegative whole number you want to check.
Select cell B1 and enter =SUMPRODUCT(MOD(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1),2)*MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)).
Press Enter. For 28975, B1 displays 21 because 9 + 7 + 5 = 21.

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. Open a spreadsheet: Open WPS Office and choose Spreadsheets, then create or open a workbook.
- 2. Enter the source number: Type 28975 in cell A1.
- 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. View the total: Press Enter and check that B1 displays 21.

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).




