A list of birthdays is reported. Persons should be divided into two groups. First group consists of persons under 21 years of age. Persons 21 or above belong to the second group.

First we need to define what is the birthday for those people who are exactly 21 years of age. Anyone whose birthday is later, belongs to group “under 21”. Who was born exactly 21 years ago or earlier belongs to “21 or older”.
Function =TODAY() returns the current date. Function DATE consists of three parts: year, month, and day. Number category for the cell E2 is date.

Here is a simple example about DATE function.
Date today is Dec 30th 2018. The border line is the date 21 years ago, the date can be calculated with DATE function. Year in DATE function is current year minus 21, the month is current month and day is current day. If the birthday of a person is exactly border line or earlier then the person is 21 or older. If person is born later than border line, then the person is under 21.
The values in cells B4:B24 are random values. You can enter values manually to test the solution. However, if you want to limit your manual work, you can use RANDBETWEEN formula. Using DATE nested formula inside RANDBETWEEN you can define lower and upper limit for random values.
The formulas are here for copy and paste:
=DATE(YEAR(F2)-21;MONTH(F2);DAY(F2))
=IF($I$2>=B4;”21 or above”;”Under 21″)
=RANDBETWEEN(DATE(1960;1;1);DATE(2015;1;1))
Another solution is to use DATEDIF function.

DATEDÍF requires earlier date, later date and type and reporting unit. B4 cell holds the birthday, TODAY() is the current date, y means that value is returned in years.

When you set DATEDIF inside IF function, function returns you the wanted result.



