Conditional Formatting based on rolling month values

nburaq

Board Regular
Joined
Apr 2, 2021
Messages
222
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hi,
I have data shown as below and would like to highlight values based on rule for always last 12 months. In my previous post this was solved bu using formula =SUM(IF(TAKE(FILTER(B2:B25,B2:B25<>""),-12)>30,1,0)) but this time I wanted to highlight cells with this part only TAKE(FILTER(B2:B25,B2:B25<>""),-12)>30 however it does not work well. I will be so glad if someone solve this problem. Thanks in advance !
DatumLocation1
Jan/2243,70
Feb/222,24
Mar/2228,96
Apr/2225,57
May/2241,19
Jun/2237,42
Jul/2241,88
Aug/2237,37
Sep/2239,31
Oct/2238,79
Nov/2237,91
Dec/2240,40
Jan/2374,69
Feb/2359,99
Mar/2360,69
Apr/2360,69
May/2352,00
Jun/23
Jul/23
Aug/23
Sep/23
Oct/23
Nov/23
Dec/23
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
so, to be clear. You want to highlight the last 12 rows where both column A and column B are populated?
I ask this because I do not see a baseline date to start going back 12 months.
 
Upvote 0
try this:

Mr excel questions 53.xlsm
ABCD
1DatumLocation1Cond Formt FormulaFormula Text
2Jan/2243.70FALSE=AND($B2<>"",$A2>=AGGREGATE(14,6,(($A$2:$A$25<>"")*($A$2:$A$25)*($B$2:$B$25<>"")),12))
3Feb/222.24FALSE
4Mar/2228.96FALSE
5Apr/2225.57FALSE
6May/2241.19FALSE
7Jun/2237.42TRUE
8Jul/2241.88TRUE
9Aug/2237.37TRUE
10Sep/2239.31TRUE
11Oct/2238.79TRUE
12Nov/2237.91TRUE
13Dec/2240.40TRUE
14Jan/2374.69TRUE
15Feb/2359.99TRUE
16Mar/2360.69TRUE
17Apr/2360.69TRUE
18May/2352.00TRUE
19Jun/23FALSE
20Jul/23FALSE
21Aug/23FALSE
22Sep/23FALSE
23Oct/23FALSE
24Nov/23FALSE
25Dec/23FALSE
Sheet1
Cell Formulas
RangeFormula
D2D2=FORMULATEXT(C2)
C2C2=AND($B2<>"",$A2>=AGGREGATE(14,6,(($A$2:$A$25<>"")*($A$2:$A$25)*($B$2:$B$25<>"")),12))
C3:C25C3=AND(B3<>"",A3>=AGGREGATE(14,6,(($A$2:$A$25<>"")*($A$2:$A$25)*($B$2:$B$25<>"")),12))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:B25Expression=AND($B2<>"",$A2>=AGGREGATE(14,6,(($A$2:$A$25<>"")*($A$2:$A$25)*($B$2:$B$25<>"")),12))textNO



1689888276174.png
 
Upvote 1
Hi
Thanks for the solution. This was what I was looking for and is more than perfect!. Actually the only baseline is counting 12 months back each time when entering the data of the current month. In given example, it is JUN/23.
 
Upvote 0
I'm happy you found a solution here at the forum. i'm sure there are other ways to accomplish the same task, but this works.
You can delete columns C & D as those were just for my development and to display in the post what is going on.

Best Wishes!
 
Upvote 0
Is it possible to add condition to this formula to highlight the values greater than 30 ? Thanks again
 
Upvote 0
Well, that is a different question that is not pertinent to the topic/title of your original post. I think the forum would want you to start a new thread.
But. have you tried to do this yourself?
Take a look at this youtube tutorial on conditional formatting:
 
Upvote 0
Sorry again, @nburaq

Here is a mini of what you asked for:

Mr excel questions 53.xlsm
ABCD
1DatumLocation1Cond Formt FormulaFormula Text
2Jan/2243.70FALSE=AND($B2>30,AND($B2<>"",$A2>=AGGREGATE(14,6,(($A$2:$A$25<>"")*($A$2:$A$25)*($B$2:$B$25<>"")),12)))
3Feb/222.24FALSE
4Mar/2228.96FALSE
5Apr/2225.57FALSE
6May/2241.19FALSE
7Jun/2237.42FALSE
8Jul/2241.88FALSE
9Aug/2237.37TRUE
10Sep/2239.31TRUE
11Oct/2238.79TRUE
12Nov/2225.00FALSE
13Dec/2240.40TRUE
14Jan/2374.69TRUE
15Feb/2359.99TRUE
16Mar/2360.69TRUE
17Apr/2360.69TRUE
18May/2352.00TRUE
19Jun/2387.00TRUE
20Jul/2390.00TRUE
21Aug/23FALSE
22Sep/23FALSE
23Oct/23FALSE
24Nov/23FALSE
25Dec/23FALSE
nburaq
Cell Formulas
RangeFormula
D2D2=FORMULATEXT(C2)
C2:C25C2=AND($B2>30,AND($B2<>"",$A2>=AGGREGATE(14,6,(($A$2:$A$25<>"")*($A$2:$A$25)*($B$2:$B$25<>"")),12)))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:B25Expression=AND($B2>30,AND($B2<>"",$A2>=AGGREGATE(14,6,(($A$2:$A$25<>"")*($A$2:$A$25)*($B$2:$B$25<>"")),12)))textNO






1689937055820.png
 
Upvote 1
Solution

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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