Do NOT count cell if adjacent cells have a 1

abrig005

Board Regular
Joined
Jan 6, 2017
Messages
82
Office Version
  1. 365
Platform
  1. Windows
Hello,
Each cell is either blank or has a 1.
I want to count the number of 1's only if there is not a 1 in any adjacent cell.
For example building 1 would only be counted under Class 2 and not 4 6 and 7
building 13 would only be counted under Class 1 and not Class 6 and 7
Class 1 is a simple count....
Class 2 would only count if there is not a 1 in the adjacent cell in Class 1 etc.

Thank you!!!!!!!!!!!!!!!
 

Attachments

  • Capture.JPG
    Capture.JPG
    81.5 KB · Views: 11
I don't know if there is a simpler way, but this is my attempt.

Book1
ABCDEF
112467
211111
32111
4311
5411
6511
7611
8711
9811
10911
111011
121111
131211
1413111
151411
161511
1716111
181711
191811
20191
21201
22211
23221
24231
25241
26251
27261
28271
29281
30291
31301
32311
33321
34331
35
36Count:2111415
Sheet1
Cell Formulas
RangeFormula
B36B36=COUNTIF(B2:B34,1)
C36C36=COUNTIFS(C2:C34,1,B2:B34,"<>1")
D36D36=COUNTIFS(D2:D34,1,B2:B34,"<>1",C2:C34,"<>1")
E36E36=COUNTIFS(E2:E34,1,C2:C34,"<>1",B2:B34,"<>1",D2:D34,"<>1")
F36F36=COUNTIFS(F2:F34,1,B2:B34,"<>1",C2:C34,"<>1",E2:E34,"<>1",D2:D34,"<>1")
 
Upvote 0

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Office 365
Thanks for that, please don't forget to update you account details to show this. ;)

How about
+Fluff 1.xlsm
ABCDEF
112467
211111
32111
4311
5411
6511
7611
8711
9811
10911
111011
121111
131211
1413111
151411
161511
1716111
181711
191811
20191
21201
22211
23221
24231
25241
26251
27261
28271
29281
30291
31301
32311
33321
34331
35
362111415
Lists
Cell Formulas
RangeFormula
B36B36=SUM(B2:B34)
C36:D36C36=SUMIFS(C2:C34,B2:B34,"")
E36E36=SUMIFS(E2:E34,B2:B34,"",C2:C34,"",D2:D34,"")
F36F36=SUMIFS(F2:F34,B2:B34,"",C2:C34,"",D2:D34,"",E2:E34,"")
 
Upvote 0
Glad we could help & thanks for the feedback.

Thanks also for updating your profile. (y)
 
Upvote 0

Forum statistics

Threads
1,214,642
Messages
6,120,701
Members
448,980
Latest member
CarlosWin

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