Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SUMIF to sum cells only if other corresponding cells contain a number

I'm trying to solve this:

enter image description here

I'm playing around with the sumif and sumifs function but I can't seem to figure it out.

It's important to sum up all cells of B only, and only if the corresponding cells A have a number in it (any number will do). This condition is important, because some cells are empty, some have random strings in it, some are marked with "N.A.", etc.

like image 408
Somebody Avatar asked Dec 05 '25 04:12

Somebody


1 Answers

If the column A numbers are strictly non-negative:

=SUMIF(A:A,">=0",B:B)

If that column may contain negative numbers:

=SUM(SUMIF(A:A,{">0","<"}&0,B:B))

Note that any numbers stored as text in column A will not be considered, neither by these solutions nor that given by zx8754.

Regards

like image 82
XOR LX Avatar answered Dec 06 '25 17:12

XOR LX



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!