Counting Consecutive Texts

nicofernandez00

New Member
Joined
Jun 24, 2014
Messages
27
Hello,

I really need help figuring out the formula for an assignment. On my spreadsheet, I have the monthly status of projects in action. From cells H28-S28, the cells are labeled either "on track", "off-track", "at risk" and "completed". I want to count the amount of consecutive times the projects were labeled "off-track" or "at risk" consecutively.

For instance:

On Track
On Track
On Track
On Track
On Track
At Risk
At Risk
At Risk
At Risk
Off Track
Off track
Off Track

<TBODY>
</TBODY>
The answer here would be 7 because "at risk" and "off track" were the consecutive statuses for seven months straight.

Please help!
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
perhaps:

Code:
=COUNTIF(H28:S28, "At Risk")+COUNTIF(H28:S28, "Off Track")
 
Upvote 0
perhaps:

Code:
=COUNTIF(H28:S28, "At Risk")+COUNTIF(H28:S28, "Off Track")


It worked! Thank you so much! However, on one row of cells, there is an extra "At Risk" that is not consecutive with the set and the formula still counts it. For example:

The clear answer here would be 7, however, the formula gives me 8 due to the "at risk" in the second cell.
[On Track][At Risk][On Track][On Track][On Track][At Risk][At Risk][At Risk][At Risk][Off Track][Off track][Off Track]


<TBODY>
</TBODY>
 
Last edited:
Upvote 0
Make sure the range in the formula is referencing what you intend. The reference may change without using an absolute reference to lock it in. This would involve adding a $ before the column (to lock the column), and row (to lock the row).

$H$28:$S$28 (locks column and row)
H$28:S$28 (locks row only)
$H28:$S28 (locks column only)
 
Upvote 0
Make sure the range in the formula is referencing what you intend. The reference may change without using an absolute reference to lock it in. This would involve adding a $ before the column (to lock the column), and row (to lock the row).

$H$28:$S$28 (locks column and row)
H$28:S$28 (locks row only)
$H28:$S28 (locks column only)



It turns out that I was plugging the formula into the wrong cells. The formula did not work for me because it simply adds up the "At risk" and "off track". It does not count them as consecutive.
 
Upvote 0
Counting Consecutive Text Values

Hello,

I really need help figuring out the formula for an assignment. On my spreadsheet, I have the monthly status of projects in action. From cells H28-S28, the cells are labeled either "on track", "off-track", "at risk" and "completed". I want to count the amount of consecutive times the projects were labeled "off-track" or "at risk" consecutively.

For instance:

On Track
On Track
At Risk
On Track
On Track
At Risk
At Risk
At Risk
At Risk
Off Track
Off track
Off Track

<TBODY>
</TBODY>

The answer here would be 7 because "at risk" and "off track" were the consecutive statuses for seven months straight. The third "At Risk" listed should not be included.

Please help!​
 
Upvote 0
Re: Counting Consecutive Text Values

If you add a cheater Row

=IF(AND(OR(H28="Off Track",H28="At Risk"),OR(OR(G28="Off Track",G28="At Risk"),OR(I28="Off Track",I28="At Risk"))),1,0) Drag Right

Then

=SUM(H29:S29)
 
Upvote 0
Re: Counting Consecutive Text Values

If you add a cheater Row

=IF(AND(OR(H28="Off Track",H28="At Risk"),OR(OR(G28="Off Track",G28="At Risk"),OR(I28="Off Track",I28="At Risk"))),1,0) Drag Right

Then

=SUM(H29:S29)

How exactly do you do this? I'm sorry I am not quite excel savvy.
 
Upvote 0
Re: Counting Consecutive Text Values

You don't need the extra row

=MAX(FREQUENCY(IF((H28:S28="Off Track")+(H28:S28="At Risk"),COLUMN(H28:S28)),IF(H28:S28="On Track",COLUMN(H28:S28))))

This is an array formula and must be correctly confirmed by entering the formula into the cell, then holding down Shift and Ctrl together and pressing Enter.
 
Upvote 0

Forum statistics

Threads
1,214,891
Messages
6,122,105
Members
449,066
Latest member
Andyg666

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