sum if adjacent cell empty or 0

DHayes

Board Regular
Joined
Nov 12, 2014
Messages
244
Good day,
I have been struggling to calculate the below. What I would like to calculate is if T is blank or 0 and A is equal 1. I need to know the sum. I have been trying with Sumif, sumproduct and countif without success. in the below example the answer should be 3. Any help will greatly be appreciated.

[TABLE="class: grid, width: 960, align: center"]
<tbody>[TR]
[TD]T
[/TD]
[TD]A
[/TD]
[TD]T
[/TD]
[TD]A
[/TD]
[TD]T
[/TD]
[TD]A
[/TD]
[TD]T
[/TD]
[TD]A
[/TD]
[TD]T
[/TD]
[TD]A
[/TD]
[TD]T
[/TD]
[TD]A
[/TD]
[TD]T
Total[/TD]
[TD]A
Total[/TD]
[TD]O
Only A not T[/TD]
[/TR]
[TR]
[TD]
[/TD]
[TD]1
[/TD]
[TD]1
[/TD]
[TD]
[/TD]
[TD]1
[/TD]
[TD]1
[/TD]
[TD]
[/TD]
[TD]1
[/TD]
[TD]1
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]1
[/TD]
[TD]3
[/TD]
[TD]4
[/TD]
[TD]3
[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
here is one idea, might need to play with it a little... formula for:

T Total: =SUM(COUNTIFS($A$2:$L$2,"T",A3:L3,{"",0}))
A Total: =SUM(COUNTIFS(A2:L2,"A",A3:L3,"1"))

not sure on the only A not T cell.. trying a couple things..
 
Last edited:
Upvote 0
Thank you for your feedback dallenk.
Soon after I posted something clicked. I used the below and works great.
Code:
=SUM(N2-(SUM(IF(FREQUENCY(IF(A1:L1="A",IF(A2:L2=1,A2:L2)),A2:L2)>0,1))))
Use CTL+SHIFT+ENTER
 
Upvote 0
Thank you Dallenk,
This one is working great much appreciated.
Code:
=SUM(COUNTIFS($A$2:$L$2,"T",A3:L3,{"",0}))
 
Upvote 0
Please help here. I thought I had the solution but to no avail. All I need to calculate is how many where A=1 and T=""or 0. It is driving me crazy. (See Post 1)
 
Upvote 0
How about this? (You may need to adjust ranges)

=SUM(IF((A1:L1="T")*(A3:L3=0), OFFSET(A3:L3, 0, 1), 0))

Entered as an array with ctrl + shift + enter.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,286
Members
452,631
Latest member
a_potato

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