Sum range if cells directly above are <> ""

kgartin

Board Regular
Joined
May 6, 2010
Messages
207
Office Version
  1. 365
Platform
  1. Windows
How do I get this to work (I know it's wrong but it makes sense in MY head):
Code:
{=SUMIF(A4:D4,A3:D3<>0)*1000}

I want the range A4:D4 only to be summed where the cells directly above are <> 0.

So if

A3 = 1
B3 = 2
C3 = 0
D3 = 0

And

A4 = 300
B4 = 500
C4 = 700
D4 = 200

then the result will be 800 (A4 + B4)
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
One way:
Code:
=SUMPRODUCT(--(A3:D3<>0),--(A4:D4))
 
Upvote 0
One way:
Code:
=SUMPRODUCT(--(A3:D3<>0),--(A4:D4))

Thanks! Figured it out with:
Code:
=SUMIF(D3:O3,">0",D4:O4)

Although not sure why I can't get it to work with:
Code:
=SUMIF(D3:O3,"<>""",D4:O4)
 
Last edited:
Upvote 0
Thanks! Figured it out with:
Code:
=SUMIF(D3:O3,">0",D4:O4)

Although not sure why I can't get it to work with:
Code:
=SUMIF(D3:O3,"<>""",D4:O4)



Aaaaaand...figured it out. Should be "<>" not "<>"""
 
Upvote 0
Your second one is checking for a non-blank entry.
If you physically have a 0 in the cells, a zero is not the same as a blank.
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,259
Members
452,626
Latest member
huntinghunter

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top