Highlighting upcoming birthdays

doherty22

New Member
Joined
May 7, 2024
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hello,

I have a spreadsheet with one column with DOBs and the next column uses this this work out their age.

Is there way I can use conditional formatting to highlight the 'age' cell in red when a big birthday (say, 50, 60, 75) is within 3 months?

Thanks
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
a few ways to do that
how are you working age out

I'm using
=AND(OR(INT(B2)=50,INT(B2)=65,INT(B2)=70),(B2-INT(B2))<0.25)

so the OR ( INT(B2)=50,INT(B2)=65,INT(B2)=70) is testing if a significant birthday - what is the full list - maybe a table of significant ages would work better

OR
=DATE(YEAR(TODAY()),MONTH(A2)-3,DAY(A2))
with the test for a particular age

and use as a conditional formatting rule

BUT I would like to see you examples and expected results


Book2
ABCDEFGH
1DOBAGETEST3monthtest
21/1/5668.3456731FALSE10/1/23TRUE
32/1/5767.2607803FALSE11/1/23TRUE
43/1/5866.1841288FALSE12/1/23TRUE
54/1/5965.0992658TRUE1/1/24TRUE
65/1/6064.0144049FALSE2/1/24TRUE
76/1/6162.9322382FALSE3/1/24TRUE
87/1/6261.8501152FALSE4/1/24TRUE
98/1/6360.7652566FALSE5/1/24TRUE
109/1/6459.6776626FALSE6/1/24FALSE
1110/1/6558.5982204FALSE7/1/24FALSE
1211/1/6657.5133643FALSE8/1/24FALSE
1312/1/6756.4312485FALSE9/1/24FALSE
141/1/6955.3456537FALSE10/1/23TRUE
152/1/7054.2607895FALSE11/1/23TRUE
163/1/7153.1841411FALSE12/1/23TRUE
174/1/7252.0965442FALSE1/1/24TRUE
185/1/7351.0171116FALSE2/1/24TRUE
196/1/7449.9322525FALSE3/1/24TRUE
207/1/7548.8501342FALSE4/1/24TRUE
218/1/7647.7625433FALSE5/1/24TRUE
229/1/7746.6803559FALSE6/1/24FALSE
2310/1/7845.5982408FALSE7/1/24FALSE
2411/1/7944.5133913FALSE8/1/24FALSE
2512/1/8043.4285454FALSE9/1/24FALSE
261/1/8242.3456641FALSE10/1/23TRUE
272/1/8341.2608044FALSE11/1/23TRUE
283/1/8440.1814236FALSE12/1/23TRUE
294/1/8539.0992471FALSE1/1/24TRUE
305/1/8638.0171288FALSE2/1/24TRUE
316/1/8736.9322767FALSE3/1/24TRUE
327/1/8835.8474288FALSE4/1/24TRUE
338/1/8934.7652293FALSE5/1/24TRUE
349/1/9033.6803817FALSE6/1/24FALSE
3510/1/9132.5982768FALSE7/1/24FALSE
3611/1/9231.5107018FALSE8/1/24FALSE
3712/1/9330.4312115FALSE9/1/24FALSE
381/1/9529.3456835FALSE10/1/23TRUE
392/1/9628.2608326FALSE11/1/23TRUE
403/1/9727.1841205FALSE12/1/23TRUE
414/1/9826.0992699FALSE1/1/24TRUE
425/1/9925.0171633FALSE2/1/24TRUE
436/1/0023.9295883FALSE3/1/24TRUE
447/1/0122.8501027FALSE4/1/24TRUE
458/1/0221.765266FALSE5/1/24TRUE
469/1/0320.680438FALSE6/1/24FALSE
4710/1/0419.5956199FALSE7/1/24FALSE
4811/1/0518.513347FALSE8/1/24FALSE
4912/1/0617.431268FALSE9/1/24FALSE
501/1/0816.3457327FALSE10/1/23TRUE
512/1/0915.2607803FALSE11/1/23TRUE
523/1/1014.1841577FALSE12/1/23TRUE
534/1/1113.0993352FALSE1/1/24TRUE
545/1/1212.0145294FALSE2/1/24TRUE
556/1/1310.9322382FALSE3/1/24TRUE
567/1/149.85017422FALSE4/1/24TRUE
578/1/158.7653983FALSE5/1/24TRUE
589/1/167.67791971FALSE6/1/24FALSE
5910/1/176.5982204FALSE7/1/24FALSE
6011/1/185.51349237FALSE8/1/24FALSE
6112/1/194.43156934FALSE9/1/24FALSE
621/1/213.34565366FALSE10/1/23TRUE
632/1/222.26094891FALSE11/1/23TRUE
643/1/231.18467852FALSE12/1/23TRUE
654/1/240.09836066FALSE1/1/24TRUE
Sheet1
Cell Formulas
RangeFormula
B2:B65B2=YEARFRAC(A2, TODAY(), 1)
C2:C65C2=AND(OR(INT(B2)=50,INT(B2)=65,INT(B2)=70),(B2-INT(B2))<0.25)
G2:G65G2=DATE(YEAR(TODAY()),MONTH(A2)-3,DAY(A2))
H2:H65H2=TODAY()>DATE(YEAR(TODAY()),MONTH(A2)-3,DAY(A2))


A good sample workbook has just 10-20 rows of representative data that has been desensitised. The sample layout accurately matches that of your real data. It also has expected results mocked up, worked examples where required, relevant cells highlighted and a few explanatory notes.

This will possibly enable a quicker and more accurate solution for you.

MrExcel has a tool called “XL2BB” that lets you post samples of your data and will allow us to copy/paste your sample data into our Excel spreadsheets, saving a lot of time.

You can also test to see if it works ok, in the "Test Here" forum.

OR if you cannot get XL2BB to work, or have restrictions on your PC

then put the sample spreadsheet onto a share

I only tend to goto OneDrive, Dropbox or google docs , as I'm never certain of other random share sites and possible virus.
Please make sure you have a representative data sample and also that the data has been desensitised, remember this site is open to anyone with internet access to see - so any sensitive / personal data should be removed

Make sure you set any share or google to share to everyone

if you have any issues with XL2BB, then the "About this Board" is the forum to ask questions about XL2BB
 
Upvote 0
I am using =DATEDIF(B2,TODAY(),"y") to work out their age

NameDOBAge
27/08/195469
30/05/195865
12/06/196261
Mr X01/06/197449
04/04/196361
13/11/195172
21/10/195370
Ms Y30/05/200320
23/07/195469
03/01/195371
24/01/196658
09/09/198340
Ms Z13/05/194479
Mr A17/05/199429
17/04/196658
24/12/196657
26/10/197053
04/12/198538
15/09/195568
13/09/199033
12/03/198440
14/09/194875
16/12/197845
18/01/197450
24/02/196361
13/07/198142
11/02/200123
03/03/195965
11/07/197152

For an example what I would like is that the ages for Mr X, Ms Y, Ms Z, and Mr A flag up in red as they are going to turn 50,21 80, and 30 respectively within 2 months.


Thank you
 
Upvote 0
this is really messy formula - and other members may see a better way

=IF(B2="","",AND(DATE(YEAR(TODAY()),MONTH(B2),DAY(B2))>=DATE(YEAR(TODAY()),MONTH(TODAY())-2,DAY(TODAY())),OR(DATEDIF((DATE(YEAR(B2),MONTH(B2)-2,DAY(B2))),TODAY(),"y")=21,DATEDIF((DATE(YEAR(B2),MONTH(B2)-2,DAY(B2))),TODAY(),"y")=30,DATEDIF((DATE(YEAR(B2),MONTH(B2)-2,DAY(B2))),TODAY(),"y")=50,DATEDIF((DATE(YEAR(B2),MONTH(B2)-2,DAY(B2))),TODAY(),"y")=80)))
and added the formula into a helper column in example column F as the main formula will not work in conditional formatting formula

then i have used in conditional formatting
=$F2

as i say , i'm sure a simplier way - perhaps using a lookup table or countif to check for the age 21,30,50 &80

i have to go out , and so will look into that as a better solution

perhaps meanwhile you could test with other examples just to make sure it is working

Book4
ABCDEF
1NameDOBAgeHELPER
28/27/5469FALSE
35/30/5865FALSE
46/12/6261FALSE
5Mr X6/1/7449TRUE
64/4/6361FALSE
711/13/5172FALSE
810/21/5370FALSE
9Ms Y5/30/0320TRUE
107/23/5469FALSE
111/3/5371FALSE
121/24/6658FALSE
139/9/8340FALSE
14Ms Z5/13/4479TRUE
15Mr A5/17/9429TRUE
164/17/6658FALSE
1712/24/6657FALSE
1810/26/7053FALSE
1912/4/8538FALSE
209/15/5568FALSE
219/13/9033FALSE
223/12/8440FALSE
239/14/4875FALSE
2412/16/7845FALSE
251/18/7450FALSE
262/24/6361FALSE
277/13/8142FALSE
282/11/0123FALSE
293/3/5965FALSE
307/11/7152FALSE
Sheet1
Cell Formulas
RangeFormula
C2:C30C2=DATEDIF((DATE(YEAR(B2),MONTH(B2),DAY(B2)) ),TODAY(),"y")
F2:F30F2=IF(B2="","",AND(DATE(YEAR(TODAY()),MONTH(B2),DAY(B2))>=DATE(YEAR(TODAY()),MONTH(TODAY())-2,DAY(TODAY())),OR(DATEDIF((DATE(YEAR(B2),MONTH(B2)-2,DAY(B2))),TODAY(),"y")=21,DATEDIF((DATE(YEAR(B2),MONTH(B2)-2,DAY(B2))),TODAY(),"y")=30,DATEDIF((DATE(YEAR(B2),MONTH(B2)-2,DAY(B2))),TODAY(),"y")=50,DATEDIF((DATE(YEAR(B2),MONTH(B2)-2,DAY(B2))),TODAY(),"y")=80)))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:A30Expression=$F2textYES


i have added the spreadsheet onto a dropbox share - will only be available for a few days

 
Upvote 0
you could use a LET as you have 365 version
=LET( DDF, DATEDIF(DATE(YEAR(B2),MONTH(B2)-2,DAY(B2)),TODAY(),"y"), AND(DATE(YEAR(TODAY()),MONTH(B2),DAY(B2))>=DDF,OR(DDF=21,DDF=30,DDF=50,DDF=80)))
and that will work in a conditional formatting formula
 
Upvote 0
Thank you, the only issue I'm having is that it is still flagging as red once the birthday has passed. Do you know if there is a fix for that?

Thanks again
 
Upvote 0
yep, still very messey
=IF(B2="","",AND(TODAY()< DATE(YEAR(TODAY()),MONTH(B2),DAY(B2)), DATE(YEAR(TODAY()),MONTH(B2),DAY(B2))>=DATE(YEAR(TODAY()),MONTH(TODAY())-2,DAY(TODAY())),OR(DATEDIF((DATE(YEAR(B2),MONTH(B2)-2,DAY(B2))),TODAY(),"y")=21,DATEDIF((DATE(YEAR(B2),MONTH(B2)-2,DAY(B2))),TODAY(),"y")=30,DATEDIF((DATE(YEAR(B2),MONTH(B2)-2,DAY(B2))),TODAY(),"y")=50,DATEDIF((DATE(YEAR(B2),MONTH(B2)-2,DAY(B2))),TODAY(),"y")=80)))
seems to work - but not exhaustively tested - just on Mrs Z - change date to 1/5/44


age-confrmt-ETAF2.xlsx
ABCDEF
1NameDOBAgeHELPER
28/27/5469.00FALSE
35/30/5865.00FALSE
46/12/6261.00FALSE
5Mr X6/1/7449.00TRUE
64/4/6361.00FALSE
711/13/5172.00FALSE
810/21/5370.00FALSE
9Ms Y5/30/0320.00TRUE
107/23/5469.00FALSE
111/3/5371.00FALSE
121/24/6658.00FALSE
139/9/8340.00FALSE
14Ms Z5/1/4480.00FALSE
15Mr A5/17/9429.00TRUE
164/17/6658.00FALSE
1712/24/6657.00FALSE
1810/26/7053.00FALSE
1912/4/8538.00FALSE
209/15/5568.00FALSE
219/13/9033.00FALSE
223/12/8440.00FALSE
239/14/4875.00FALSE
2412/16/7845.00FALSE
251/18/7450.00FALSE
262/24/6361.00FALSE
277/13/8142.00FALSE
282/11/0123.00FALSE
293/3/5965.00FALSE
307/11/7152.00FALSE
Sheet1
Cell Formulas
RangeFormula
C2:C30C2=DATEDIF((DATE(YEAR(B2),MONTH(B2),DAY(B2)) ),TODAY(),"y")
F2:F30F2=IF(B2="","",AND(TODAY()< DATE(YEAR(TODAY()),MONTH(B2),DAY(B2)), DATE(YEAR(TODAY()),MONTH(B2),DAY(B2))>=DATE(YEAR(TODAY()),MONTH(TODAY())-2,DAY(TODAY())),OR(DATEDIF((DATE(YEAR(B2),MONTH(B2)-2,DAY(B2))),TODAY(),"y")=21,DATEDIF((DATE(YEAR(B2),MONTH(B2)-2,DAY(B2))),TODAY(),"y")=30,DATEDIF((DATE(YEAR(B2),MONTH(B2)-2,DAY(B2))),TODAY(),"y")=50,DATEDIF((DATE(YEAR(B2),MONTH(B2)-2,DAY(B2))),TODAY(),"y")=80)))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:A30Expression=$F2textNO
 
Upvote 0

Forum statistics

Threads
1,216,109
Messages
6,128,875
Members
449,476
Latest member
pranjal9

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