Consecutive formula, not counting most recent sequence

jchick90

New Member
Joined
Feb 22, 2024
Messages
4
Office Version
  1. 365
Platform
  1. Windows
This is my first post, so please go easy on me :)

I'm trying to calculate the number of consecutive cells in which a value appears, but the most right/recent set of consecutive only.

I'm currently using the following formula, but it's presenting the highest consecutive value, rather than the most recent.

=MAX(FREQUENCY(IF(B2:O2<>"",COLUMN(B2:O2)),IF(B2:O2="",COLUMN(B2:O2))))

The red values are the desired result, and those next to it are what the above formula is currently producing.



r/excel - Help needed. Consecutive Formula
Any help is much appreciated!

Thanks so much in advance
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Welcome to the MrExcel board!

I suggest that you investigate XL2BB for providing sample data to make it easier for helpers by not having to manually type out sample data to test with.

See how this goes

24 02 22.xlsm
BCDEFGHIJKLMNOP
1
2001811212254.25520236.24235
31202011222
411.1
53333
60
71111111111111114
Recent
Cell Formulas
RangeFormula
P2:P7P2=LEN(TEXTAFTER(" "&TRIM(CONCAT(IF(B2:O2=""," ",1)))," ",-1))
 
Last edited:
Upvote 0
Welcome to the MrExcel board!

I suggest that you investigate XL2BB for providing sample data to make it easier for helpers by not having to manually type out sample data to test with.

See how this goes

24 02 22.xlsm
BCDEFGHIJKLMNOP
1
2001811212254.25520236.24235
31202011222
411.1
53333
60
71111111111111114
Recent
Cell Formulas
RangeFormula
P2:P7P2=LEN(TEXTAFTER(" "&TRIM(CONCAT(IF(B2:O2=""," ",1)))," ",-1))

Thank you so much!
That works a treat!
Can I ask another favour if possible please?
Say if b1 to p1 were headers, what formula could I use to pull through the header where the most recent sequence starts?

I'm currently using this: =IFERROR(INDEX(B$1:DQ$1,SMALL(IF($B2:$DQ2<>"",COLUMN($B2:$DQ2)-COLUMN(A2)),1)),"")

But it seems to return the first ever value, rather than the first value in the latest sequence.

Thanks so much again
 
Upvote 0
Try this

24 02 22.xlsm
BCDEFGHIJKLMNOPQ
1Hdr1Hdr2Hdr3Hdr4Hdr5Hdr6Hdr7Hdr8Hdr9Hdr10Hdr11Hdr12Hdr13Hdr14Recent SeqRecent Start
2001811212254.25520236.24235Hdr10
31202011222Hdr10
4111Hdr4
53333Hdr1
60 
71111111111111114Hdr1
Recent
Cell Formulas
RangeFormula
P2:P7P2=LEN(TEXTAFTER(" "&TRIM(CONCAT(IF(B2:O2=""," ",1)))," ",-1))
Q2:Q7Q2=IFNA(INDEX(B$1:O$1,XMATCH("?*",B2:O2&"",2,-1)-P2+1),"")
 
Upvote 0
Solution
Try this

24 02 22.xlsm
BCDEFGHIJKLMNOPQ
1Hdr1Hdr2Hdr3Hdr4Hdr5Hdr6Hdr7Hdr8Hdr9Hdr10Hdr11Hdr12Hdr13Hdr14Recent SeqRecent Start
2001811212254.25520236.24235Hdr10
31202011222Hdr10
4111Hdr4
53333Hdr1
60 
71111111111111114Hdr1
Recent
Cell Formulas
RangeFormula
P2:P7P2=LEN(TEXTAFTER(" "&TRIM(CONCAT(IF(B2:O2=""," ",1)))," ",-1))
Q2:Q7Q2=IFNA(INDEX(B$1:O$1,XMATCH("?*",B2:O2&"",2,-1)-P2+1),"")
My hero! Can't thank you enough
 
Upvote 0
Welcome to the MrExcel Message Board!

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Consecutive Count
and Consecutive formula, not counting most recent sequence
There is no need to repeat the link(s) provided above but if you have posted the question at other places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0
Welcome to the MrExcel Message Board!

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Consecutive Count
and Consecutive formula, not counting most recent sequence
There is no need to repeat the link(s) provided above but if you have posted the question at other places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
Apologies, I wasn't aware of these
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,250
Members
452,623
Latest member
Techenthusiast

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