Age Formula Baserow

Hi All,

I’m using Cloud Hosted.

I have a Date column which is called ‘Date of Birth’, I am trying to create an Age column and use the today() formula to get the age of each person using the Date of Birth. I cannot get this to work for various reasons - keep getting errors about the expected result being a date field rather than text or number.

Would someone be able to help me with this? I feel like I’m missing something super simple but can’t quite figure it out at the moment. I just want to use the Date of Birth to generate the Age in a separate column.

On another note, It would be useful if I could someone how use the age data to group rows by age bands e.g. those aged 18-24, 25-34, 35-54? Any ideas on how I can achieve this without minimal user input?

Thanks!

Hey @NicoR93, sure, try using this formula:

date_diff('yy', field('your_date_field'), today())

1 Like

You can add another formula and then group by its results:
if(and(field('Age') >= 18, field('Age') <= 24), '18-24', if(and(field('Age') >= 25, field('Age') <= 34), '25-34', if(and(field('Age') >= 35, field('Age') <= 54), '35-54', 'Age out of range')))

Is it what you’re looking for?

1 Like

Thank you so much that’s worked perfectly!

1 Like