Jan 21, 2021 03:19 AM
Hi, i need help with a formula if this is possible.
i have a table containing a “date” field and a “formula” field that calculates the age from that.
( DATETIME_DIFF(TODAY(), {Person nr}, ‘years’) & ’ years, ’ & MOD(DATETIME_DIFF(TODAY(), {Person nr}, ‘months’), 12) & ’ months’ )
everything is perfect here so far, but i would like to make a new field that contains age groups,
like 0-10, 10-18, 18-30, 30-50, 50-100 lets say. is there a formula for making this? and can it change buy it self when a person goes from let say age 29 to 30 and so on?
or
is there a way to search, filter or group already for lets say ages between 20-40 or 30 and up? or 25-45?
Hope you understand what i am looking for, and every help i can get would be much appreciated!
Thanks,
Viktor
Update:
if its more simple to remove the “months” thats ok.
Solved! Go to Solution.
Jan 25, 2021 08:04 AM
You’re on the right track but it needs some adjusting. In Airtable this is done with nested IF
statements.
IF( {age} < 13, "0-12",
IF( {age} < 19, "13-18",
IF( {age} < 30, "19-29",
IF( {age} < 46, "30-45",
IF( {age} < 61, "46-60",
IF( {age} < 101, "60-100", "101+"
))))))
Note that this will only work if there is an age. If there isn’t an age, the formula will group the record in the “0-12” group. Also note that my first age group starts at 0 instead of 1. There are ways of adjusting the formula to take care of these issues if they are important, but this should be enough to get you started.
Jan 25, 2021 12:39 PM
Thank you!!! its works perfectly