Hello
Shminhas,
If your range contains some cells with "Kg" and others with "NA" or other non-numeric text, you need to modify the formula to ignore non-numeric values while summing only the cells that contain "Kg".
Use the following SUMPRODUCT formula to only sum values that contain "Kg":
=SUMPRODUCT(--ISNUMBER(SEARCH("Kg",D5
9)) * SUBSTITUTE(D5
9," Kg",""))
Explanation:
- SEARCH("Kg",D5
9) checks if "Kg" is present in each cell.
- ISNUMBER(SEARCH("Kg",D5
9)) returns TRUE for cells containing "Kg" and FALSE otherwise.
- SUBSTITUTE(D5
9," Kg","") removes "Kg" from the numbers.
- Multiplying by --ISNUMBER(...) ensures only valid numbers with "Kg" are included in the sum.
- SUMPRODUCT(...) sums only the filtered numeric values.
Example:
If your D5

9 contains:
25 Kg
10 Kg
NA
7 Kg
30 Kg
The formula will correctly sum 25 + 10 + 7 + 30 = 72 while ignoring "NA".
This method ensures that only cells containing "Kg" are summed, ignoring any other text entries like "NA".