Formula to "true" is 3 consecutive conditions are met

Redsleeper

New Member
Joined
Sep 22, 2023
Messages
5
Office Version
  1. 365
Platform
  1. Windows
HI, Looking for some assistance with this as I am struggling! – is there a formula that will return “true” if somebody has 3 1s in a row but once/if they have 3 0s it changes back to “N/A” ? it’s to check up to the latest month and not beyond as they will all have 0s in them (this date is in a separate cell as well (O7 in the original spreadsheet) any help appreciated!!!
1695380837282.png
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Welcome to the forum.

Is your image an expected result?
If these are expected why do you write: "once/if they have 3 0s it changes back to “N/A”" when you have many records with one or two 0's reverting back to no formatting?

If they aren't expected can you give a scenario with the expectations.

As a note, the Mr. Excel forum has a tool, called xl2bb add in (link below) that allows users to post mini worksheets of their work. This does a number of things that will more likely assure you of a speedy solution. 1. It means the forum does not have to recreate your scenario from scratch Which takes time and many forum users will ignore your question. 2. It will have no typos of data errors. 3. The forum can focus on a solution instead of the scenario.

If you cannot use the xl2bb add in, then please post your data in a table (label column and row headers please) provide any formulas you have in the data. And expected results are really helpful.

Thanks in advance.
 
Upvote 0
Welcome to the forum.

Is your image an expected result?
If these are expected why do you write: "once/if they have 3 0s it changes back to “N/A”" when you have many records with one or two 0's reverting back to no formatting?

If they aren't expected can you give a scenario with the expectations.

As a note, the Mr. Excel forum has a tool, called xl2bb add in (link below) that allows users to post mini worksheets of their work. This does a number of things that will more likely assure you of a speedy solution. 1. It means the forum does not have to recreate your scenario from scratch Which takes time and many forum users will ignore your question. 2. It will have no typos of data errors. 3. The forum can focus on a solution instead of the scenario.

If you cannot use the xl2bb add in, then please post your data in a table (label column and row headers please) provide any formulas you have in the data. And expected results are really helpful.

Thanks in advance.
Thank you.

Yes, its just an image of the expected result - sorry, I probably haven't explained it very well, at any point if one of the rows has a sequence of 3 1s consecutively it should return "true", it will stay true until it then has a run of 3 consecutive 0s where it will revert back to "N/A", so one or two 0s should not change it back it there where 3 consecutive 1s at some point before. Hopefully that's a little clearer?
To give some context its a sheet from a larger workbook that tracks if repayments have been made against loans, if someone has missed a payment it returns a 1, I need to track all that have had at some point 3 missing payments until they have had 3 successful payments

I will try remove some of the data that I cant share and upload a version of the sheet as you say it would quicker and more accurate.

thanks
 
Upvote 0
So, heres a shot for you - it looks for the sequence of 0's (or missed payments) that end the month before todays date (which I think you said was stored in O7 ?).

If it finds the sequence, it gives you a TRUE. Main formula is in B2 for example, but I've included another couple in there to show how its made up - you can delete those of course from your version.

Let us know how it looks ?

roster.xlsm
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAF
1May-20Jun-20Jul-20Aug-20Sep-20Oct-20Nov-20Dec-20Jan-21Feb-21Mar-21Apr-21May-21Jun-21Jul-21Aug-21Sep-21Oct-21Nov-21Dec-21Jan-22May-23Jun-23Jul-23Aug-23Sep-23Oct-23Nov-23Dec-23Jan-24
2Person1TRUE111100100111101111111100010000
3
423
501/09/2023
601/09/2023
722/09/2023
Sheet1
Cell Formulas
RangeFormula
B2B2=IF(INDEX(C1:AF1,1,(FIND("000",CONCAT(C2:AF2))+2))<O7-DAY(O7)+1,TRUE,FALSE)
B4B4=FIND("000",CONCAT(C2:AF2))
B5B5=INDEX(C1:AF1,1,26)
B6B6=O7-DAY(O7)+1
O7O7=TODAY()


(of course you'll have to adjust the range across the columns to suit your sheet)
 
Last edited:
Upvote 0
I think this also does what you ask, but it does require two blank columns before your data. What it is doing is taking 3 arrays looking back 2 month and the current month and multiplying if the values are 1 or 0. and then multiplying by the row column number. This will give the last month with 3 consecutive 1's or 3 consecutive 0's. Then comparing those to get TRUE or NA.

Mr excel questions 63.xlsm
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAOAPAQAR
1
2May-20Jun-20Jul-20Aug-20Sep-20Oct-20Nov-20Dec-20Jan-21Feb-21Mar-21Apr-21May-21Jun-21Jul-21Aug-21Sep-21Oct-21Nov-21Dec-21Jan-22Feb-22Mar-22Apr-22May-22Jun-22Jul-22Aug-22Sep-22Oct-22Nov-22Dec-22Jan-23Feb-23Mar-23Apr-23May-23Jun-23Jul-23Aug-23
3Person 1#N/A0000000000000000001111111111111111000000
4Person 2#N/A0000000000000000000000000000000000001011
5Person 3TRUE0000000000000000000100010111001000011100
6Person 4TRUE0000000000000000000111111111111111001110
7Person 5TRUE0000000000000000011111111001111101111011
8Person 6#N/A0000000000000000000001100000010001110001
9Person 7#N/A0000000000000000000000011111111111000000
redsleeper
Cell Formulas
RangeFormula
F2:AR2F2=EDATE(E2,1)
B3:B9B3=LET( array1,$C3:$AP3,array2,$D3:$AQ3,array3,$E3:$AR3, last3peat1,MAX(IFERROR((array1)*(array2)*(array3),0)*(COLUMN(array3))), last3peat0,MAX(IFERROR((0=array1)*(0=array2)*(0=array3),0)*(COLUMN(array3))), IF(last3peat1 > last3peat0,TRUE,NA()))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
E3:AR9Expression=E3=1textNO
 
Upvote 0
I think this also does what you ask, but it does require two blank columns before your data. What it is doing is taking 3 arrays looking back 2 month and the current month and multiplying if the values are 1 or 0. and then multiplying by the row column number. This will give the last month with 3 consecutive 1's or 3 consecutive 0's. Then comparing those to get TRUE or NA.

Mr excel questions 63.xlsm
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAOAPAQAR
1
2May-20Jun-20Jul-20Aug-20Sep-20Oct-20Nov-20Dec-20Jan-21Feb-21Mar-21Apr-21May-21Jun-21Jul-21Aug-21Sep-21Oct-21Nov-21Dec-21Jan-22Feb-22Mar-22Apr-22May-22Jun-22Jul-22Aug-22Sep-22Oct-22Nov-22Dec-22Jan-23Feb-23Mar-23Apr-23May-23Jun-23Jul-23Aug-23
3Person 1#N/A0000000000000000001111111111111111000000
4Person 2#N/A0000000000000000000000000000000000001011
5Person 3TRUE0000000000000000000100010111001000011100
6Person 4TRUE0000000000000000000111111111111111001110
7Person 5TRUE0000000000000000011111111001111101111011
8Person 6#N/A0000000000000000000001100000010001110001
9Person 7#N/A0000000000000000000000011111111111000000
redsleeper
Cell Formulas
RangeFormula
F2:AR2F2=EDATE(E2,1)
B3:B9B3=LET( array1,$C3:$AP3,array2,$D3:$AQ3,array3,$E3:$AR3, last3peat1,MAX(IFERROR((array1)*(array2)*(array3),0)*(COLUMN(array3))), last3peat0,MAX(IFERROR((0=array1)*(0=array2)*(0=array3),0)*(COLUMN(array3))), IF(last3peat1 > last3peat0,TRUE,NA()))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
E3:AR9Expression=E3=1textNO
thank you so much for the reply and apologies for the delay in responding I finally got a chance to try this today - this works great for the current month but is there a way to write it so it will update each month automatically? so the arrays will move on to the next months cells?
 
Upvote 0
So, heres a shot for you - it looks for the sequence of 0's (or missed payments) that end the month before todays date (which I think you said was stored in O7 ?).

If it finds the sequence, it gives you a TRUE. Main formula is in B2 for example, but I've included another couple in there to show how its made up - you can delete those of course from your version.

Let us know how it looks ?

roster.xlsm
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAF
1May-20Jun-20Jul-20Aug-20Sep-20Oct-20Nov-20Dec-20Jan-21Feb-21Mar-21Apr-21May-21Jun-21Jul-21Aug-21Sep-21Oct-21Nov-21Dec-21Jan-22May-23Jun-23Jul-23Aug-23Sep-23Oct-23Nov-23Dec-23Jan-24
2Person1TRUE111100100111101111111100010000
3
423
501/09/2023
601/09/2023
722/09/2023
Sheet1
Cell Formulas
RangeFormula
B2B2=IF(INDEX(C1:AF1,1,(FIND("000",CONCAT(C2:AF2))+2))<O7-DAY(O7)+1,TRUE,FALSE)
B4B4=FIND("000",CONCAT(C2:AF2))
B5B5=INDEX(C1:AF1,1,26)
B6B6=O7-DAY(O7)+1
O7O7=TODAY()


(of course you'll have to adjust the range across the columns to suit your sheet)
HI, thank you very much for the attempt at this and apologies for the delay in replying - I can almost get this to work how i want with some minor changes - i changed it to this - =IFERROR(IF(H254="no payments","TRUE",IF(INDEX($T$9:$CX$9,1,(FIND("111",CONCAT(T254:CX254))+2))<$O$7-DAY($O$7)+1,TRUE,"N/A")),"N/A") - I was getting a lot of Value results as sometimes the sequence would not be there so added in the iferror, could you please help me to understand which months its looking at? I can see that it looks for the date in O7 in the index array - how can I adjust this part of the formula to look at and include the current month? it seems to not be including it. Sorry if this doe snot make sense! I'm not that great with spreadsheets!
 
Upvote 0
thank you so much for the reply and apologies for the delay in responding I finally got a chance to try this today - this works great for the current month but is there a way to write it so it will update each month automatically? so the arrays will move on to the next months cells?

I'll see what I can do. I'm assuming you would put the next month in the next available column to the right? Or are you inserting cells at the beginning?
Please confirm.
 
Upvote 0
Okay, this will give you 100 months.
Mr excel questions 63.xlsm
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAOAPAQARASATAUAVAWAXAYAZBABBBCBDBEBFBGBHBIBJBKBLBMBNBOBPBQBRBSBTBUBVBWBXBYBZCACBCCCDCECFCGCHCICJCKCLCMCNCOCPCQCRCSCTCUCVCWCXCYCZ
1
2May-20Jun-20Jul-20Aug-20Sep-20Oct-20Nov-20Dec-20Jan-21Feb-21Mar-21Apr-21May-21Jun-21Jul-21Aug-21Sep-21Oct-21Nov-21Dec-21Jan-22Feb-22Mar-22Apr-22May-22Jun-22Jul-22Aug-22Sep-22Oct-22Nov-22Dec-22Jan-23Feb-23Mar-23Apr-23May-23Jun-23Jul-23Aug-23Sep-23Oct-23Nov-23Dec-23Jan-24Feb-24Mar-24Apr-24May-24Jun-24Jul-24Aug-24Sep-24Oct-24Nov-24Dec-24Jan-25Feb-25Mar-25Apr-25May-25Jun-25Jul-25Aug-25Sep-25Oct-25Nov-25Dec-25Jan-26Feb-26Mar-26Apr-26May-26Jun-26Jul-26Aug-26Sep-26Oct-26Nov-26Dec-26Jan-27Feb-27Mar-27Apr-27May-27Jun-27Jul-27Aug-27Sep-27Oct-27Nov-27Dec-27Jan-28Feb-28Mar-28Apr-28May-28Jun-28Jul-28Aug-28
3Person 1#N/A0000000000000000001111111111111111000000010010011000110001100011000000011110011001101000111000101000
4Person 2#N/A0000000000000000000000000000000000001011011011101110110100001001110101010100101000011000100110101101
5Person 3TRUE0000000000000000000100010111001000011100000101101000000001001111010010000111011011101011010101111100
6Person 4TRUE0000000000000000000111111111111111001110100010100000110010100101011001110110100010101001111011101001
7Person 5TRUE0000000000000000011111111001111101111011001011010111011000010101011000101110001010001010110001010111
8Person 6#N/A0000000000000000000001100000010001110001100101100000011010111011101110010001100010110111110001100000
9Person 7TRUE0000000000000000000000011111111111000000000110100011101011110100000101110000011110100110011011001110
redsleeper
Cell Formulas
RangeFormula
F2:CZ2F2=EDATE(E2,1)
B3:B9B3=LET( array1,$C3:$CX3,array2,$D3:$CY3,array3,$E3:$CZ3, last3peat1,MAX(IFERROR((array1)*(array2)*(array3),0)*(COLUMN(array3)-4)), last3peat0,MAX(IFERROR((0=array1)*(0=array2)*(0=array3),0)*(COLUMN(array3))), RESULT,IF(last3peat1 > last3peat0,TRUE,NA()),RESULT)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
E3:CZ9Expression=E3=1textNO
 
Upvote 0
I'll see what I can do. I'm assuming you would put the next month in the next available column to the right? Or are you inserting cells at the beginning?
Please confirm.
thank you so much, yes the nexts month data will be in the next column to the right.
 
Upvote 0

Forum statistics

Threads
1,224,885
Messages
6,181,587
Members
453,055
Latest member
cope7895

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