Conditional Formatting based on age range

CMW

New Member
Joined
Dec 20, 2023
Messages
9
Office Version
  1. 365
Platform
  1. Windows
Hi
I have a list of names and dates of birth and have a separate column that calculates the age (at a given date) based on the date of birth, giving the answer in X Years, X Months.

I am trying to use conditional formatting to highlight the names that fall within a set age range for example all those who are between 8 years and 0 months and 9 years and 6 months at the given date. I thought I had cracked it, but when I looked at my results the conditional formatting was also highlighting cells where the age is 9 years, 11 months. Not sure where I have gone wrong or what the solution is (if there is one!).

TIA
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Are the years and months in separate columns or in the same column?
 
Upvote 0
Are the years and months in separate columns or in the same column?
The years and months are in the same column, as they are a calculation based on the date of birth and the given date using this formula:

=DATEDIF(C43,$D$1,"Y")&" Years, "&DATEDIF(C43,$D$1,"YM")&" Months"
 
Upvote 0
Try the below CF formula, where C43 is the start of your range of data:
Excel Formula:
=LET(
y,--TEXTBEFORE(C43," Y"),
m,--TEXTBEFORE(TEXTAFTER(C43,", ")," M"),
AND(y>=8,m>=0,y<=9,m<=6))
 
Upvote 0
Sorry your data (X Years, X Months) may be in column D, if it is swap, the C43 for D43
 
Upvote 0
So there's no way of doing it with conditional formatting?
 
Upvote 0
Probably user error, bit your formula doesn't seem to work :( . This is what the spreadsheet looks like. What I would like is to be able to highlight those children that fall within certain age bands, and as I change the date at the top (each term), the formatting will change to reflect the fact that they may fall into a new age band. Hope that makes sense!
 

Attachments

  • Sample image.JPG
    Sample image.JPG
    33.7 KB · Views: 15
Upvote 0
Sorry, can't get the XL2BB to work on my pc (weird set up!) Hope these images help ....
 

Attachments

  • Sample image 2.JPG
    Sample image 2.JPG
    73.5 KB · Views: 18
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,187
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