Counting number of adjacent cells

BuddJ

New Member
Joined
Apr 14, 2016
Messages
42
Hia,

I am looking for a formula that will count the number of adjacent cells that meet a specific condition starting from Column A & looking for the word Required.

In the example below ......
Row 1 should return 2
Row 2 should return 1
Row 3 should return 2
Row 4 should return 3
Row 5 should return 0
Row 6 should return 0

RequiredRequiredN#A
RequiredMatch (12-JUN-18)Required
RequiredRequired
RequiredRequiredRequired
Not RequiredRequiredRequired
Match (12-JUN-18)RequiredMatch (12-JUN-18)

<tbody>
</tbody>

Hope the above makes sense - have been bashing my head on this one for hours now so hoping someone can point me in the right direction.

Many thanks !!
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
You need to define "a number of adjacent cells"

I have a solution based on your three columns but you're implying there may be more than three in whcih my solution won't work
 
Upvote 0
You need to define "a number of adjacent cells"

I have a solution based on your three columns but you're implying there may be more than three in whcih my solution won't work

There are a total of 7 columns in the range that I need to evaluate.
 
Last edited:
Upvote 0
Given now that there are 7 columns what is the expected result if you have Required in columns

A B D E F

A and B are adjacent that would return 2 in your original example
but now there are 7 columns so should the result be 3 (D E F)
Hence the need to ask how many columns there would be.

So the question is are you looking for the maximum number of adjacent cells in a row that contain "Required"?
 
Upvote 0
Given now that there are 7 columns what is the expected result if you have Required in columns

A B D E F

A and B are adjacent that would return 2 in your original example
but now there are 7 columns so should the result be 3 (D E F)
Hence the need to ask how many columns there would be.

So the question is are you looking for the maximum number of adjacent cells in a row that contain "Required"?
 
Upvote 0
For rows that start with the word "Required" in the first Column, the formula needs to count how many cells to the right have the word "Required" in them as long as they are adjacent to each other. As soon as a cell contains any word apart from "Required" then the count should stop & ignore the remainder of the row.

In the original example irrespective of what data is in in columns D, E, F for row 1 the count would still be 2 as the N#A would stop the formula.
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,935
Members
449,094
Latest member
teemeren

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