Spreadsheet Practice

How to check if someone is over 18 from their date of birth in Excel

Formula (Excel and Google Sheets)

=IF(DATEDIF(B2,$F$1,"y")>=18,"Yes","No")

Count whole years with DATEDIF and compare: =IF(DATEDIF(B2,$F$1,"y")>=18,"Yes","No"), with =TODAY() or an as-of date in F1.

Result on the example
one result per row in C2, filled down to C7
Works in
Every current version
Google Sheets
Same formula

See it work

The formula is already in C2, filled down to C7. Change any input and the result updates, or edit the formula to experiment.

How it works

DATEDIF with "y" counts complete years between two dates, which is the age. Ava turns 18 on the as-of date itself, so she qualifies; Ben's birthday is one day later, so he is still 17.

=IF(DATEDIF(B2,$F$1,"y")>=18,"Yes","No")

Result"Yes"

  1. B210/29/2008

    The value in B2.

  2. $F$110/29/2026

    The value in F1.

  3. DATEDIF(B2,$F$1,"y")18

    DATEDIF: Difference in "Y", "M", "D", "YM", "MD" or "YD".

    • start_dateB210/29/2008
    • end_date$F$110/29/2026
    • unit"y"
  4. DATEDIF(B2,$F$1,"y")>=18TRUE

    The >= operator tests at least.

  5. IF(DATEDIF(B2,$F$1,"y")>=18,"Yes","No")"Yes"

    IF: Returns one value if a test is true, another if false.

    • logical_testDATEDIF(B2,$F$1,"y")>=18TRUE
    • value_if_true"Yes"
    • value_if_false"No"not used

In Google Sheets

The same formula works in Google Sheets: =IF(DATEDIF(B2,$F$1,"y")>=18,"Yes","No"). We ran it in Google Sheets mode on the same data and it returns the same results.

Other ways to do it

Each one was run on the same example sheet.

FormulaResultWhen to use it
=IF(EDATE(B2,12*18)<=$F$1,"Yes","No")Yes, No, Yes…EDATE finds the 18th birthday; if it is on or before the as-of date, the person is 18.
=DATEDIF(B2,$F$1,"y")18, 17, 31…Different resultThe age itself, if you want it on the sheet. Shows the ages: 18, 17, 31, 16, 18, 17.

Common mistakes

  • Dividing the days by 365 drifts around birthdays because of leap years. DATEDIF counts whole years correctly.
  • A birth date after the as-of date makes DATEDIF return #NUM!.

Try it yourself

Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.

Check if someone is over 18 from their date of birth

In C2, show "Yes" when the person is at least 18 on the date in F1, otherwise "No". Fill down to C7.

Questions

How do I check against today?

Use TODAY(): =IF(DATEDIF(B2,TODAY(),"y")>=18,"Yes","No").

How do I count the adults in the list?

Count birth dates on or before the date 18 years earlier: =COUNTIF(B2:B7,"<="&EDATE(F1,-216)).

Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.