When entries have no corresponding entry IN RANGE indicated by conditional format

ozbeachbum

Board Regular
Joined
Jun 3, 2015
Messages
246
Office Version
  1. 2021
Platform
  1. Windows
When entries in D9:13 have no corresponding entry F9:13 indicated by conditional format B7
if P & date.xlsx
BCDEFGH
2Looking for a formula to be used in Conditional Formatting
3Where Ever "D" has the Letter P and "H" has NO DATE
4Result will be Indicated in "B7"
5
6
7IndAmountDate
8
9P$ 1.00Mon 01-Jul-41
10
11P$ 2.00
12
13$ -
14
15
P NO DATE
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
just to confirm
you want B7 to show whenever
D9 to D13 - has a P or H
AND
No corresponding date in H9 to H13

What about F ???

=(COUNTIFS( $D$9:$D$13, "P", $H$9:$H$13 , "") + COUNTIFS( $D$9:$D$13, "H", $H$9:$H$13 , ""))>0

This will count if there is a P and blank date -
And also Add a count if there is an H and blank date

if blank dates then highlight for P and H


Book1
ABCDEFGHIJ
1
2Looking for a formula to be used in Conditional Formatting
3Where Ever "D" has the Letter P and "H" has NO DATE
4Result will be Indicated in "B7"
5
6TEST
7IndAmountDateTRUE
8
9P17/1/41
10
11P27/1/41
12
13H0
14
15
Sheet1
Cell Formulas
RangeFormula
J7J7=(COUNTIFS( $D$9:$D$13, "P", $H$9:$H$13, "") + COUNTIFS( $D$9:$D$13, "H", $H$9:$H$13, ""))>0
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B7Expression=(COUNTIFS( $D$9:$D$13, "P", $H$9:$H$13, "") + COUNTIFS( $D$9:$D$13, "H", $H$9:$H$13, ""))>0textYES


for 2007, 2010 , 2013 , 2016 , 2019 or 365 Subscription excel version
Conditional Formatting

Highlight applicable range >>
B7 - Change, reduce or extend the rows to meet your data range of rows

Home Tab >> Styles >> Conditional Formatting
New Rule >> Use a formula to determine which cells to format
Edit the Rule Description: Format values where this formula is true:
=(COUNTIFS( $D$9:$D$13, "P", $H$9:$H$13 , "") + COUNTIFS( $D$9:$D$13, "H", $H$9:$H$13 , ""))>0

Format [Number, Font, Border, Fill]
choose the format you would like to apply when the condition is true
OK >> OK
 
Upvote 0
Solution
Please try this. The VBA code needs to be in a standard module.

Book7
BCDEFGH
2Looking for a formula to be used in Conditional Formatting
3Where Ever "D" has the Letter P and "H" has NO DATE
4Result will be Indicated in "B7"
5
6
7IndAmountDate
8
9P17/1/2041
10
11P2
12
130
14
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
D8:D22Expression=AND($D8="P",issdate($H8)=FALSE)textNO


VBA Code:
Function IssDate(rng As Variant) As Boolean
  Application.Volatile
  
  IssDate = IsDate(rng)

End Function
 
Upvote 0
just to confirm
you want B7 to show whenever
D9 to D13 - has a P or H
AND
No corresponding date in H9 to H13

What about F ???

=(COUNTIFS( $D$9:$D$13, "P", $H$9:$H$13 , "") + COUNTIFS( $D$9:$D$13, "H", $H$9:$H$13 , ""))>0

This will count if there is a P and blank date -
And also Add a count if there is an H and blank date

if blank dates then highlight for P and H


Book1
ABCDEFGHIJ
1
2Looking for a formula to be used in Conditional Formatting
3Where Ever "D" has the Letter P and "H" has NO DATE
4Result will be Indicated in "B7"
5
6TEST
7IndAmountDateTRUE
8
9P17/1/41
10
11P27/1/41
12
13H0
14
15
Sheet1
Cell Formulas
RangeFormula
J7J7=(COUNTIFS( $D$9:$D$13, "P", $H$9:$H$13, "") + COUNTIFS( $D$9:$D$13, "H", $H$9:$H$13, ""))>0
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B7Expression=(COUNTIFS( $D$9:$D$13, "P", $H$9:$H$13, "") + COUNTIFS( $D$9:$D$13, "H", $H$9:$H$13, ""))>0textYES


for 2007, 2010 , 2013 , 2016 , 2019 or 365 Subscription excel version
Conditional Formatting

Highlight applicable range >>
B7 - Change, reduce or extend the rows to meet your data range of rows

Home Tab >> Styles >> Conditional Formatting
New Rule >> Use a formula to determine which cells to format
Edit the Rule Description: Format values where this formula is true:
=(COUNTIFS( $D$9:$D$13, "P", $H$9:$H$13 , "") + COUNTIFS( $D$9:$D$13, "H", $H$9:$H$13 , ""))>0

Format [Number, Font, Border, Fill]
choose the format you would like to apply when the condition is true
OK >> OK
just to confirm
you want B7 to show whenever
D9 to D13 - has a P or H
AND
No corresponding date in H9 to H13

H was just the column letter
D9 to D13 - has a P
AND
No corresponding date in H9 to H13

Thanks I just removed the + COUNTIFS( $D$9:$D$13, "H", $H$9:$H$13 , "") from your formula and it does exactly what I wanted it to do.
 
Upvote 0
Please try this. The VBA code needs to be in a standard module.

Book7
BCDEFGH
2Looking for a formula to be used in Conditional Formatting
3Where Ever "D" has the Letter P and "H" has NO DATE
4Result will be Indicated in "B7"
5
6
7IndAmountDate
8
9P17/1/2041
10
11P2
12
130
14
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
D8:D22Expression=AND($D8="P",issdate($H8)=FALSE)textNO


VBA Code:
Function IssDate(rng As Variant) As Boolean
  Application.Volatile
 
  IssDate = IsDate(rng)

End Function
Thanks for taking the time to reply, however I need it to cover a range, so went with etaf's formula.
 
Upvote 0
you are welcome
I miss read the text to say P & H rather than H column dah!!! - I see it now
 
Upvote 0

Forum statistics

Threads
1,225,747
Messages
6,186,792
Members
453,371
Latest member
HMX180

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