Highlighting Cells IF Conditions Met

rprieto7

New Member
Joined
Feb 18, 2024
Messages
5
Office Version
  1. 365
Platform
  1. MacOS
Hello,

I work for a public school. We are trying to upgrade our attendance call log spreadsheet, and I was tasked w/ doing it as the tech-savvy guy. I built out the entire sheet by myself, but I have hit a snag in finishing this project.

I created a bunch of pivot tables (every two weeks of school). If a student misses 3 or more days in 2 weeks, then their name gets highlighted on the pivot table. If their name gets highlighted in that specific pivot table, then I would like for that name to be flagged on the main table.

How do I highlight a cell if it matches another name in that same sheet AND if that name has previously been highlighted in the pivot table?

Thank You!
 

Attachments

  • Screen Shot 2024-02-18 at 8.22.32 AM.png
    Screen Shot 2024-02-18 at 8.22.32 AM.png
    50.4 KB · Views: 8
  • Screen Shot 2024-02-18 at 8.23.49 AM.png
    Screen Shot 2024-02-18 at 8.23.49 AM.png
    103.1 KB · Views: 9

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
You'll need to probably tweak this as the PIVOT TABLE guts won't copy over with the xl2bb mini sheet.
But, essentially use the GETPIVOTDATA() Function in a Conditional Formatting Statement:
(column C is just me confirming how the CF formula will work, it is not needed in your final worksheet).

The conditional formatting formula for cell A2 is:
Excel Formula:
=GETPIVOTDATA("[Measures].[Count of Date Missed]",$E$2,"[Range].[Student]","[Range].[Student].&["&A2&"]")>=3

If you are not using the Data Model for the pivot table, then the CF formula is this:
Excel Formula:
=GETPIVOTDATA("Date Missed",$E$2,"Student",A2)>=3



Book1
ABCDEFG
1StudentDate Missed
2YLQ2024-02-03FALSERow LabelsCount of Date Missed
3AOA2024-02-12FALSEAOA1
4WJK2024-02-11FALSEBMF2
5NKG2024-02-12FALSEFID2
6BMF2024-02-10FALSEGIV3
7RMZ2024-02-12FALSEJOU2
8FID2024-02-09FALSENKG1
9GIV2024-02-11TRUERGN3
10RGN2024-02-17TRUERMZ2
11JOU2024-02-13FALSEWJK1
12BMF2024-02-05FALSEYLQ1
13RMZ2024-02-16FALSEGrand Total18
14FID2024-02-07FALSE
15GIV2024-02-07TRUE
16RGN2024-02-08TRUE
17JOU2024-02-11FALSE
18GIV2024-02-16TRUE
19RGN2024-02-08TRUE
20JOU2024-02-14FALSE
21
Sheet2
Cell Formulas
RangeFormula
C2:C20C2=GETPIVOTDATA("[Measures].[Count of Date Missed]",$E$2,"[Range].[Student]","[Range].[Student].&["&A2&"]")>=3
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:A20Expression=GETPIVOTDATA("[Measures].[Count of Date Missed]",$E$2,"
#VALUE!
#VALUE!
#VALUE!
 
Last edited:
Upvote 0
Solution
That was really helpful. I am on the verge of figuring this out, but now a new problem has arised.

My pivot tables take into account "blanks" so considering there are greater than 3 blanks, it is highlighting the entire excel sheet. Is there anyway to make this formula w/ except highlighting of blanks in the conditional formatting?
 

Attachments

  • Screen Shot 2024-02-18 at 2.20.30 PM.png
    Screen Shot 2024-02-18 at 2.20.30 PM.png
    81 KB · Views: 4
Upvote 0
That is a little beyond me. If you use the Data Model Pivot Table, it seems to ignore those.
If you use do not use the Data Model, go to Pivot Table Options and change the For Blank Cells Value to NA() or something like that.
(not sure it will count for you or not).

But from a data standpoint, why do you have essentially empty rows for this, unless you have other columns not related to Absences?

You may be able to filter the blank values out. But that could be time consuming.
 
Upvote 0
There is a check box in Field Value Setting for "Show Items with No Data", but when I uncheck it, it still shows that Student Name. So strange.
I can't figure it out.
 
Upvote 0
Howdy,

Yeah, there are a bunch of other columns not related to the absence that I am not allowed to show. That would explain it :LOL:.

I was able to figure it out though while discussing this with you, so all good!

Thank You,
 
Upvote 0
okay, happy you figured it out. Would you mind sharing your solution and marking it? If anyone searches for Conditional Formatting based on Pivot Tables they can come find it.
 
Upvote 0
I was able to go to the pivot table and filter out the blanks. This meant that it would not be picked up by the conditional formatting, which is exactly what we wanted. I will mark this thread as resolved.
 
Upvote 0
Great, happpy to help! Best Wishes!
 
Upvote 0

Forum statistics

Threads
1,215,097
Messages
6,123,076
Members
449,094
Latest member
mystic19

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