Count the value with reference to the parallel cells

ExcelNewbie2020

Active Member
Joined
Dec 3, 2020
Messages
360
Office Version
  1. 365
Platform
  1. Windows
Need to count the how many time the value "2" appear in a table provided the it is followed or preceded by an empty cell. Please see the expected result.. thank you

Book1
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAH
2EXPECTED RESULT
3count the value 2 preceded by empty cell("")count the value 2 followed by empty cell("")
4A233333333333331A32
5A3333222B23
6A23333331C3
7B333333333332233
8B33333333333222
9B33333333333333333333333331
10C233333333333331
11C333333333331233
12C233333333333331
13
Sheet1
 
Try this

25 03 08.xlsm
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAH
2EXPECTED RESULT
32 preceded by empty2 followed by empty
4A233333333333331A32
5A3333222B23
6A23333331C30
7B333333333332233
8B33333333333222
9B33333333333333333333333331
10C233333333333331
11C333333333331233
12C233333333333331
Count
Cell Formulas
RangeFormula
AG4:AG6AG4=SUMPRODUCT((A$4:A$12=AF4)*(B$4:AB$12="")*(C$4:AC$12=2))
AH4:AH6AH4=SUMPRODUCT((A$4:A$12=AF4)*(B$4:AB$12=2)*(C$4:AC$12=""))
 
Last edited:
Upvote 0
Solution

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