Conditioning Help

FatalLordes

Board Regular
Joined
Dec 22, 2017
Messages
76
Office Version
  1. 365
Platform
  1. Windows
Hi all

Imagine a table like the following:
NameDescDate
FelixVax Two01/10/2023
GizmoVax One14/03/2024
FelixVax One01/09/2023
GeorgeVax Three19/07/2023
GeorgeVax Three19/07/2024

What I would like to do is use conditional formatting to highlight a row if one of the following conditions are met:

1. The date for a Vax One is greater than 30 days from today, and there is no Vax Two entry for the same name;
2. The date for a Vax Two is greater than 30 days from today;
3. The most recent date for Vax Three for the same name is greater than 365 days from today

I'm not really sure how to do this. Would it be three separate conditions I need to do? I think I can figure one the second condition but I'm not sure about the first and third. Any help would be greatly appreciated.

Thanks
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
So I've worked out number 2 (and realised it should have been if greater than 365 days from today), being the following:

=AND(B1="Vax Two", $C1<TODAY()-365)

But it only highlights cell A... no biggie but would be nice to highlight the whole row.

But I don't know how to 1 where it needs to do the AND but also confirm there is no Vax Two for the same name anywhere in the table, or how to do 3 where it it need to make sure it is looking at the most recent date in the table for the name.

I'll keep playing and if I work it out I will pop it here but apreciate any guidance.
 
Upvote 0
I believe number one should be
=AND(IF(B1="Vax One",IF(TODAY()-C1>365,TRUE,FALSE)),COUNTIFS(B$1:B$5,"=Vax Two",A$1:A$5,A1)=0)

To achieve highlighting of the whole row, select the whole area (eg A1:C5) then write your formula as if it were applying to the cell at top left.
 
Upvote 0
I believe number one should be
=AND(IF(B1="Vax One",IF(TODAY()-C1>365,TRUE,FALSE)),COUNTIFS(B$1:B$5,"=Vax Two",A$1:A$5,A1)=0)

To achieve highlighting of the whole row, select the whole area (eg A1:C5) then write your formula as if it were applying to the cell at top left.
Thanks myall_blues. That works. I still can't get it to highlight the whole row. Yes, I am selecting the whole area (actually selecting entire column A-C) and I'm writing as if for line 1, but it just wont. As said, not a deal breaker but would be nice.

I've actually just realised I need to include a condition to all three of the ones I'm trying to do (two which I have now and only the 3rd one to go) where it needs to check another tab in the workbook to see if the name exists and if it has a field that says "adopted" (because we don't need to highlight adopted animals). I will see if I can work it out based on your example :) Thank you SO much.
 
Upvote 0
What version of Excel are you using? Knowing will affect the solution to 3.
 
Upvote 0
If you’re using Excel 2019 or later this will work for 3.

Excel Formula:
=AND($C1=MAXIFS(C$1:C$5,B$1:B$5,"Vax Three",A$1:A$5,$A1),TODAY()-$C1>365)

To fix the row highlighting issue in you first formula change B1 to $B1. Likewise with the first formula I supplied - change A1, B1 and C1 to $A1 etc.
 
Last edited:
Upvote 0
If you’re using Excel 2019 or later this will work for 3.

Excel Formula:
=AND($C1=MAXIFS(C$1:C$5,B$1:B$5,"Vax Three",A$1:A$5,$A1),TODAY()-$C1>365)

To fix the row highlighting issue in you first formula change B1 to $B1. Likewise with the first formula I supplied - change A1, B1 and C1 to $A1 etc.
Thank you so much. Yes this works BUT I changed the 5 to 9999 because the list of rows will always increase and it is highlighting the blank rows with nothing in them. Is there a way to say just look until there is nothing else in column A (so reach the end of the data rows)?
 
Upvote 0
So I'm trying to reference a sheet in the work book, but it isn't liking my formula and I figure I've done it wrong (obviously) but not sure where. So building on from what you have been guiding me, I need to add for all of the three formulas that it check the sheet called Main and the table is called Main (I assume it is table1 as its the only table on that sheet but I can't find where to confirm that) and find the same name in column A as the disregard the conditional check if the cell in column D says "Adopted" (as we don't need to follow up on adopted animals as they are no longer in our care). Following is what I had but Excel doesn't like it.

=AND(IF($D1="Vax - Two", $B1<TODAY()-365)),COUNTIFS("'Main'!Table1[Main]":$D$1:$D$9999,"Adopted",$A$1:$A$9999,$A1)=0)
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

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