Conditional Highlighting Cells by Fiscal Quarters?

olimits7

Board Regular
Joined
Oct 29, 2004
Messages
229
Office Version
  1. 365
Platform
  1. Windows
Hi,

Please see below, currently I'm manually highlighting the colors based on different quarters starting from the "1st Inv. Date" as the "1st Month", I'm trying to see if there is a way this can be automatically updated using "Conditional Formatting".

So, as an example, taking the 09/01/23 invoice date; Q3 would fall under columns E, F, G and is highlighted in orange.

I was trying to set this up as 2 options:
  • Using a pull-down menu and depending on what quarter I select it will automatically highlight the appropriate cells.

  • Using conditional formatting, just set up different rules where it would highlight the correct cells in different colors representing the different quarters like I manually did below.

1699047974218.png


Thank you!
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Here is for your second option:

Book1
ABCDEFGHIJKLMNO
1
2
39/1/2023
4
5
6123456789101112
7Customer Name1st Inv. Date1st Month2nd Month3rd Month4th Month5th Month6th Month7th Month8th Month9th Month10th Month11th Month12th Month
84/1/2023100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00
95/1/2023100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00
106/1/2023100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00
117/1/2023100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00
128/1/2023100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00
139/1/2023100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00
1410/1/2023100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00
1511/1/2023100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
D8:O15Expression=AND(MONTH($B8)+D$6>13,MONTH($B8)+D$6<=16)textNO
D8:O15Expression=AND(MONTH($B8)+D$6>10,MONTH($B8)+D$6<=13)textNO
D8:O15Expression=AND(MONTH($B8)+D$6>7,MONTH($B8)+D$6<=10)textNO
D8:O15Expression=MONTH($B8)+D$6<=7textNO
 
Last edited:
Upvote 0
I did it with quarter numbers in your cells but I hope you get the idea, and continues into the next year.


Mr Excel Questions 71.xlsm
ABCDEFGHIJKLMN
1Q1 Yellow
2Q2 Green
3Q3 Orange
4Q4 Blue
5
6123456789101112
7Customer1st Inv Date1st Month2nd Month3rd Month4th Month5th Month6th Month7th Month8th Month9th Month10th Month11 Month12 Month
8Customer12023-04-01111222333444
9Customer22023-05-01112223334441
10Customer32023-06-01122233344411
11Customer42023-07-01222333444111
12Customer52023-08-01223334441112
13Customer62023-09-01233344411122
14Customer72023-10-01333444111222
15Customer82023-11-01334441112223
16
17
18Formula in cell C8=INT(((MONTH($B8)+C$6-2)-(IF(MONTH($B8)+C$6-2>14,12,0)))/3)
olimits7
Cell Formulas
RangeFormula
C8:N15C8=INT(((MONTH($B8)+C$6-2)-(IF(MONTH($B8)+C$6-2>14,12,0)))/3)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C8:N15Expression=INT(((MONTH($B8)+C$6-2)-(IF(MONTH($B8)+C$6-2>14,12,0)))/3)=4textNO
C8:N15Expression=INT(((MONTH($B8)+C$6-2)-(IF(MONTH($B8)+C$6-2>14,12,0)))/3)=3textNO
C8:N15Expression=INT(((MONTH($B8)+C$6-2)-(IF(MONTH($B8)+C$6-2>14,12,0)))/3)=2textNO
C8:N15Expression=INT(((MONTH($B8)+C$6-2)-(IF(MONTH($B8)+C$6-2>14,12,0)))/3)=1textNO
 
Last edited:
Upvote 0
Updated rules to handle both options, data validation list in B3 contains "ALL, Q1, Q2, Q3, Q4":

Book1
ABCDEFGHIJKLMNO
1
2LEGEND
3Q3Q1Q2
4Q3Q4
5
6123456789101112
7Customer Name1st Inv. Date1st Month2nd Month3rd Month4th Month5th Month6th Month7th Month8th Month9th Month10th Month11th Month12th Month
84/1/2023100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00
95/1/2023100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00
106/1/2023100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00
117/1/2023100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00
128/1/2023100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00
139/1/2023100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00
1410/1/2023100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00
1511/1/2023100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
D8:O15Expression=AND(OR($B$3="ALL",$B$3="Q4"),MONTH($B8)+D$6>13,MONTH($B8)+D$6<=16)textNO
D8:O15Expression=AND(OR($B$3="ALL",$B$3="Q3"),MONTH($B8)+D$6>10,MONTH($B8)+D$6<=13)textNO
D8:O15Expression=AND(OR($B$3="ALL",$B$3="Q2"),MONTH($B8)+D$6>7,MONTH($B8)+D$6<=10)textNO
D8:O15Expression=AND(OR($B$3="ALL",$B$3="Q1"),MONTH($B8)+D$6<=7)textNO
Cells with Data Validation
CellAllowCriteria
B3ListALL,Q1,Q2,Q3,Q4
 
Upvote 0
Updated rules to handle both options, data validation list in B3 contains "ALL, Q1, Q2, Q3, Q4":

Book1
ABCDEFGHIJKLMNO
1
2LEGEND
3Q3Q1Q2
4Q3Q4
5
6123456789101112
7Customer Name1st Inv. Date1st Month2nd Month3rd Month4th Month5th Month6th Month7th Month8th Month9th Month10th Month11th Month12th Month
84/1/2023100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00
95/1/2023100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00
106/1/2023100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00
117/1/2023100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00
128/1/2023100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00
139/1/2023100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00
1410/1/2023100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00
1511/1/2023100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
D8:O15Expression=AND(OR($B$3="ALL",$B$3="Q4"),MONTH($B8)+D$6>13,MONTH($B8)+D$6<=16)textNO
D8:O15Expression=AND(OR($B$3="ALL",$B$3="Q3"),MONTH($B8)+D$6>10,MONTH($B8)+D$6<=13)textNO
D8:O15Expression=AND(OR($B$3="ALL",$B$3="Q2"),MONTH($B8)+D$6>7,MONTH($B8)+D$6<=10)textNO
D8:O15Expression=AND(OR($B$3="ALL",$B$3="Q1"),MONTH($B8)+D$6<=7)textNO
Cells with Data Validation
CellAllowCriteria
B3ListALL,Q1,Q2,Q3,Q4

This seems to work well, thank you for the reply!

The only issue I'm running into is I have blank rows so for some cells under the B column it's blank but the conditional formatting is highlighted the whole rows; is there a way to exclude the conditional formatting from being applied if there is a cell in column B that's blank?

Thank you!
 
Upvote 0
A quick way to fix that would be to wrap each conditional format rule with an
=IF(cellref = "", FALSE, the rest of conditional rule)
 
Upvote 0
A quick way to fix that would be to wrap each conditional format rule with an
=IF(cellref = "", FALSE, the rest of conditional rule)

Yes, that seemed to work for the blank invoice date cells. However, now I'm seeing these other issues that I can't seem to resolve.

  • For some reason, if the invoice date is 11/01/22 it doesn't highlight the row at all for the correct Q1 month (April, May, June) sections.

  • And on the invoice date month that shows 01/01/23, you can see in the "CURRENTLY" section below it's highlighting the full row from the beginning and not just the Q1 month (Apr, May, June) sections only.

  • Also, is there a way I can exclude highlighting on cells where it shows zero? So below in the "CURRENTLY" section if I set it to Q2 it highlights those sections but I would like to exclude the highlighting if it shows a zero amount.

1699205457381.png


Thank you!
 
Upvote 0
Ok, well, Id id not write the CF rules that you probably have in that image. This is how mine have been updated:

Mr Excel Questions 71.xlsm
ABCDEFGHIJKLMNO
1Q1 Yellow
2Q2 Green
3Q3 Orange
4Q4 Blue
5
6123456789101112
7Customer1st Inv Date1st Month2nd Month3rd Month4th Month5th Month6th Month7th Month8th Month9th Month10th Month11 Month12 Month
8Customer12023-04-01111222333444
9Customer22023-05-01112223334441
10
11Customer32023-06-01122233344411
12Customer42023-07-01222333444111
13
14Customer52023-08-01223334441112
15Customer62023-09-01233344411122
16Customer72023-10-01333444111222
17Customer82023-11-01334441112223
18
19
olimits7
Cell Formulas
RangeFormula
C8:N9,C14:N17,C11:N12C8=INT(((MONTH($B8)+C$6-2)-(IF(MONTH($B8)+C$6-2>14,12,0)))/3)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C8:N17Expression=IF($B8="",FALSE,INT(((MONTH($B8)+C$6-2)-(IF(MONTH($B8)+C$6-2>14,12,0)))/3))=4textNO
C8:N17Expression=IF($B8="",FALSE,INT(((MONTH($B8)+C$6-2)-(IF(MONTH($B8)+C$6-2>14,12,0)))/3))=3textNO
C8:N17Expression=IF($B8="",FALSE,INT(((MONTH($B8)+C$6-2)-(IF(MONTH($B8)+C$6-2>14,12,0)))/3))=2textNO
C8:N17Expression=IF($B8="",FALSE,INT(((MONTH($B8)+C$6-2)-(IF(MONTH($B8)+C$6-2>14,12,0)))/3))=1textNO




This is my guess as to how to update the "selection" version's CF rules:
=IF($B8 = "", FALSE, AND(OR($B$3="ALL",$B$3="Q4"),MONTH($B8)+D$6>13,MONTH($B8)+D$6<=16) )
=IF($B8 = "", FALSE,AND(OR($B$3="ALL",$B$3="Q3"),MONTH($B8)+D$6>10,MONTH($B8)+D$6<=13))
=IF($B8 = "", FALSE,AND(OR($B$3="ALL",$B$3="Q2"),MONTH($B8)+D$6>7,MONTH($B8)+D$6<=10))
=IF($B8 = "", FALSE,AND(OR($B$3="ALL",$B$3="Q1"),MONTH($B8)+D$6<=7))
 
Upvote 0
Ok, well, Id id not write the CF rules that you probably have in that image. This is how mine have been updated:

Mr Excel Questions 71.xlsm
ABCDEFGHIJKLMNO
1Q1 Yellow
2Q2 Green
3Q3 Orange
4Q4 Blue
5
6123456789101112
7Customer1st Inv Date1st Month2nd Month3rd Month4th Month5th Month6th Month7th Month8th Month9th Month10th Month11 Month12 Month
8Customer12023-04-01111222333444
9Customer22023-05-01112223334441
10
11Customer32023-06-01122233344411
12Customer42023-07-01222333444111
13
14Customer52023-08-01223334441112
15Customer62023-09-01233344411122
16Customer72023-10-01333444111222
17Customer82023-11-01334441112223
18
19
olimits7
Cell Formulas
RangeFormula
C8:N9,C14:N17,C11:N12C8=INT(((MONTH($B8)+C$6-2)-(IF(MONTH($B8)+C$6-2>14,12,0)))/3)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C8:N17Expression=IF($B8="",FALSE,INT(((MONTH($B8)+C$6-2)-(IF(MONTH($B8)+C$6-2>14,12,0)))/3))=4textNO
C8:N17Expression=IF($B8="",FALSE,INT(((MONTH($B8)+C$6-2)-(IF(MONTH($B8)+C$6-2>14,12,0)))/3))=3textNO
C8:N17Expression=IF($B8="",FALSE,INT(((MONTH($B8)+C$6-2)-(IF(MONTH($B8)+C$6-2>14,12,0)))/3))=2textNO
C8:N17Expression=IF($B8="",FALSE,INT(((MONTH($B8)+C$6-2)-(IF(MONTH($B8)+C$6-2>14,12,0)))/3))=1textNO




This is my guess as to how to update the "selection" version's CF rules:
=IF($B8 = "", FALSE, AND(OR($B$3="ALL",$B$3="Q4"),MONTH($B8)+D$6>13,MONTH($B8)+D$6<=16) )
=IF($B8 = "", FALSE,AND(OR($B$3="ALL",$B$3="Q3"),MONTH($B8)+D$6>10,MONTH($B8)+D$6<=13))
=IF($B8 = "", FALSE,AND(OR($B$3="ALL",$B$3="Q2"),MONTH($B8)+D$6>7,MONTH($B8)+D$6<=10))
=IF($B8 = "", FALSE,AND(OR($B$3="ALL",$B$3="Q1"),MONTH($B8)+D$6<=7))

Thank you for the quick reply!

I ended up trying your formulas and they work well the only issue I'm seeing is the following. I want to show just the current fiscal year highlighted, so for example only dates that would get highlighted between April'23 to March'24.

So, I see if the date is 05/01/23 it highlights May/June months properly in the 1st/2nd Month columns but then it's also highlighting the 12th month too which would calculate to April'24 and shouldn't get highlighted.

Similar issue if the date is 07/01/23; it's highlighting the April/May/June months in the 10th/11th/12th column which is correct, if just going off the month, but these columns would fall under the next fiscal year being 04/01/24 to 06/01/24 and shouldn't get highlighted.


1699209335391.png


Thank you.
 
Upvote 0
Okay, this has 2023 hard coded in the CF rules. You can probably automate that a bit better.

Mr Excel Questions 71.xlsm
ABCDEFGHIJKLMNO
7123456789101112
8Customer1st Inv Date1st Month2nd Month3rd Month4th Month5th Month6th Month7th Month8th Month9th Month10th Month11 Month12 Month
9Customer12023-Apr-01111222333444
10Customer22023-May-0111222333444FALSE
11FALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSE
12Customer32023-Jun-011222333444FALSEFALSE
13Customer42023-Jul-01222333444FALSEFALSEFALSE
14FALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSE
15Customer52023-Aug-0122333444FALSEFALSEFALSEFALSE
16Customer62023-Sep-012333444FALSEFALSEFALSEFALSEFALSE
17Customer72023-Oct-01333444FALSEFALSEFALSEFALSEFALSEFALSE
18Customer82023-Nov-0133444FALSEFALSEFALSEFALSEFALSEFALSEFALSE
19
20
21Formula in cell C9=IFERROR(IF(YEAR(EDATE($B9,-4+C$7))<>2023,FALSE, INT(((MONTH($B9)+C$7-2)-(IF(MONTH($B9)+C$7-2>14,12,0)))/3)),FALSE)
22
23123456789101112
24Customer1st Inv Date1st Month2nd Month3rd Month4th Month5th Month6th Month7th Month8th Month9th Month10th Month11 Month12 Month
25Customer12023-Apr-01100100100100100100100100100100100100
26Customer22023-May-01100100100100100100100100100100100100
272021-Jan-01100100100100100100100100100100100100
28Customer32023-Jun-01100100100100100100100100100100100100
29Customer42023-Jul-01100100100100100100100100100100100100
30100100100100100100100100100100100100
31Customer52023-Aug-01100100100100100100100100100100100100
32Customer62023-Sep-01100100100100100100100100100100100100
33Customer72023-Oct-01100100100100100100100100100100100100
34Customer82023-Nov-01100100100100100100100100100100100100
35
olimits7
Cell Formulas
RangeFormula
C9:N18C9=IFERROR(IF(YEAR(EDATE($B9,-4+C$7))<>2023,FALSE, INT(((MONTH($B9)+C$7-2)-(IF(MONTH($B9)+C$7-2>14,12,0)))/3)),FALSE)
C21C21=FORMULATEXT(C9)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C9:N18,C23:N34Expression=IFERROR(IF(YEAR(EDATE($B9,-4+C$7))<>2023,FALSE, INT(((MONTH($B9)+C$7-2)-(IF(MONTH($B9)+C$7-2>14,12,0)))/3))=1,FALSE)textNO
C9:N18,C23:N34Expression=IFERROR(IF(YEAR(EDATE($B9,-4+C$7))<>2023,FALSE, INT(((MONTH($B9)+C$7-2)-(IF(MONTH($B9)+C$7-2>14,12,0)))/3))=2,FALSE)textNO
C9:N18,C23:N34Expression=IFERROR(IF(YEAR(EDATE($B9,-4+C$7))<>2023,FALSE, INT(((MONTH($B9)+C$7-2)-(IF(MONTH($B9)+C$7-2>14,12,0)))/3))=3,FALSE)textNO
C9:N18,C23:N34Expression=IFERROR(IF(YEAR(EDATE($B9,-4+C$7))<>2023,FALSE, INT(((MONTH($B9)+C$7-2)-(IF(MONTH($B9)+C$7-2>14,12,0)))/3))=4,FALSE)textNO
 
Upvote 0
Solution

Forum statistics

Threads
1,215,113
Messages
6,123,165
Members
449,099
Latest member
bes000

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