Forum Discussion
cdiaa
Mar 06, 2020Copper Contributor
How do I find the sum of cells that are either one number or the other?
I have a spreadsheet with 2500 rows of 10 randomly generated numbers (either 1, -1, 10, -10, 100 or -100). For every row, I want 3 functions. The first would calculate the absolute value of the sum o...
- Mar 06, 2020
You can change the formulas as follows:
=SUMPRODUCT(IF(ABS(A1:J1)=1,A1:J1))
=SUMPRODUCT(IF(ABS(A1:J1)=10,A1:J1))/10
=SUMPRODUCT(IF(ABS(A1:J1)=100,A1:J1))/100
Twifoo
Mar 06, 2020Silver Contributor
Your requirement is equivalent to the count of specific absolute numbers. Thus, the formula for the count of absolute 1's is:
=SUMPRODUCT(--(ABS($A1:$J1)=1))
For 10's, the formula will be:
=SUMPRODUCT(--(ABS($A1:$J1)=10))
For 100's, the formula will be:
=SUMPRODUCT(--(ABS($A1:$J1)=100))
See the results of the foregoing formulas in the attached file.