Dynamic Formula To Label Rolling 3 Months.

Cubist

Well-known Member
Joined
Oct 5, 2023
Messages
1,909
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hi,

I need a formula that generates the "label" column below.
In the boolean column, there's always one and only one continuous range of TRUE.
When the boolean = TRUE, I want to generate a "Rolling 3 xxx" label starting from the last 3 months. Sometimes there aren't multiple of 3's so I want to label it "Incomplete Rolling 3".
When the boolean = FALSE, label it "-".

Book1
ABC
2MonthBooleanLabel
31/31/21FALSE-
42/28/21FALSE-
53/31/21FALSE-
64/30/21FALSE-
75/31/21TRUEIncomeplete Rolling 3
86/30/21TRUEIncomeplete Rolling 3
97/31/21TRUERolling 3 Prior - 2
108/31/21TRUERolling 3 Prior - 2
119/30/21TRUERolling 3 Prior - 2
1210/31/21TRUERolling 3 Prior - 1
1311/30/21TRUERolling 3 Prior - 1
1412/31/21TRUERolling 3 Prior - 1
151/31/22TRUERolling 3 Prior
162/28/22TRUERolling 3 Prior
173/31/22TRUERolling 3 Prior
184/30/22TRUERolling 3 Current
195/31/22TRUERolling 3 Current
206/30/22TRUERolling 3 Current
217/31/22FALSE-
228/31/22FALSE-
239/30/22FALSE-
2410/31/22FALSE-
2511/30/22FALSE-
Sheet1
Cell Formulas
RangeFormula
A4:A25A4=EOMONTH(A3,1)
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Try:

Book3
ABC
1
2MonthBooleanLabel
31/31/2021FALSE-
42/28/2021FALSE-
53/31/2021FALSE-
64/30/2021FALSE-
75/31/2021TRUEIncomplete Rolling 3
86/30/2021TRUEIncomplete Rolling 3
97/31/2021TRUERolling 3 Prior - 2
108/31/2021TRUERolling 3 Prior - 2
119/30/2021TRUERolling 3 Prior - 2
1210/31/2021TRUERolling 3 Prior - 1
1311/30/2021TRUERolling 3 Prior - 1
1412/31/2021TRUERolling 3 Prior - 1
151/31/2022TRUERolling 3 Prior
162/28/2022TRUERolling 3 Prior
173/31/2022TRUERolling 3 Prior
184/30/2022TRUERolling 3 Current
195/31/2022TRUERolling 3 Current
206/30/2022TRUERolling 3 Current
217/31/2022FALSE-
228/31/2022FALSE-
239/30/2022FALSE-
2410/31/2022FALSE-
2511/30/2022FALSE-
26
Sheet6
Cell Formulas
RangeFormula
C3:C25C3=LET(r,B3:B25,t,COUNTIF(r,TRUE),s,SEQUENCE(t),a,IFS(s>INT(t/3)*3,"Incomplete Rolling 3",s<4,"Rolling 3 Current",s<7,"Rolling 3 Prior",1,"Rolling 3 Prior - "&INT((s-7)/3)+1),v,XLOOKUP(TRUE,r,ROW(r),,0),IF(r,INDEX(a,t+v-ROW(r)),"-"))
A4:A25A4=EOMONTH(A3,1)
Dynamic array formulas.
 
Upvote 0
Solution

Forum statistics

Threads
1,223,894
Messages
6,175,254
Members
452,624
Latest member
gregg777

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