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.

T
A
T
A
T
A
T
A
T
A
T
A
T
Total
A
Total
O
Only A not T

1
1

1
1

1
1


1
3
4
3

<tbody>
</tbody>
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
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
After doing multiple tests My formula does not work. Any assistance will be appreciated.
 
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,213,544
Messages
6,114,239
Members
448,555
Latest member
RobertJones1986

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