# Calculate and Display User's Age (from Date of Birth)

**URL:** https://community.glideapps.com/t/calculate-and-display-users-age-from-date-of-birth/4049
**Category:** Ask for Help
**Created:** [January 28, 2020, 11:58pm UTC](https://community.glideapps.com/t/calculate-and-display-users-age-from-date-of-birth/4049 "2020-01-28T23:58:28Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![Jerry](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jerry/32/3043_2.png) [@Jerry](https://community.glideapps.com/u/Jerry)
#### Post date: [January 28, 2020, 11:58pm UTC](https://community.glideapps.com/t/calculate-and-display-users-age-from-date-of-birth/4049/1 "2020-01-28T23:58:28Z")

</div>

How do I get the date of birth of a user to calculate and display the user’s age?

---

<div class="post-metadata">

### Author: ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)
#### Post date: [January 29, 2020, 12:27am UTC](https://community.glideapps.com/t/calculate-and-display-users-age-from-date-of-birth/4049/2 "2020-01-29T00:27:02Z")

</div>

I use a formula like this in the sheet where A2:A just checks if the row is populated and M2:M is the column that contains the date of birth:  
`=ARRAYFORMULA(IF(LEN(A2:A) = 0, "", " **Age:**" & IF(M2:M = "", "", DATEDIF(M2:M, TODAY(), "Y"))))`

---

<div class="post-metadata">

### Author: ![Jerry](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jerry/32/3043_2.png) [@Jerry](https://community.glideapps.com/u/Jerry)
#### Post date: [January 29, 2020, 12:56am UTC](https://community.glideapps.com/t/calculate-and-display-users-age-from-date-of-birth/4049/3 "2020-01-29T00:56:15Z")

</div>

My mind is a bit blown right now. LOL. So A2 and M2 are cells on the spreadsheet?

Whats the A and M then?  
Can you send a screen shot or something of what you did?

Then how do you display it?

Thanks

---

<div class="post-metadata">

### Author: ![Jerry](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jerry/32/3043_2.png) [@Jerry](https://community.glideapps.com/u/Jerry)
#### Post date: [January 29, 2020, 12:58am UTC](https://community.glideapps.com/t/calculate-and-display-users-age-from-date-of-birth/4049/4 "2020-01-29T00:58:10Z")

</div>

> [@Jeff\_Hager](#):
>
> =ARRAYFORMULA(IF(LEN(A2:A) = 0, “”, " **Age:**" & IF(M2:M = “”, “”, DATEDIF(M2:M, TODAY(), “Y”))))

So the whole formula goes into one cell?

---

<div class="post-metadata">

### Author: ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)
#### Post date: [January 29, 2020, 1:18am UTC](https://community.glideapps.com/t/calculate-and-display-users-age-from-date-of-birth/4049/5 "2020-01-29T01:18:02Z")

</div>

You can start out simpler and use `=DATEDIF(M2, TODAY(), “Y”)` but you would have to put the formula in each row. Eventually you will find that arrayformula’s work much better. I recommend reading up on how arrayformulas work.

I’m assuming that you would place the formula on row 2. That is the only place you would need put the formula. All of the following rows will automatically apply the formula. The A2:A tells the formula to start at column A row 2 and apply the formula down the entire A column.

I’m displaying the age in my app as part of a bunch of markdown. It might be confusing to show you all of that. You can you a basic text or rich text to display the value.

---

<div class="post-metadata">

### Author: ![Jerry](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jerry/32/3043_2.png) [@Jerry](https://community.glideapps.com/u/Jerry)
#### Post date: [January 29, 2020, 1:36am UTC](https://community.glideapps.com/t/calculate-and-display-users-age-from-date-of-birth/4049/6 "2020-01-29T01:36:00Z")

</div>

> [@Jeff\_Hager](#):
>
> arrayformulas

Cool thanks. I will read up on it first.

---

<div class="post-metadata">

### Author: ![Jerry](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jerry/32/3043_2.png) [@Jerry](https://community.glideapps.com/u/Jerry)
#### Post date: [January 29, 2020, 4:00am UTC](https://community.glideapps.com/t/calculate-and-display-users-age-from-date-of-birth/4049/7 "2020-01-29T04:00:15Z")

</div>

> [@Jeff\_Hager](#):
>
> ARRAYFORMULA

Learned ARRAYFORMULA. It worked.

You’re a genius  
Thanks again

---

<div class="post-metadata">

### Author: ![Darren\_Alderman](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_alderman/32/66660_2.png) [@Darren\_Alderman](https://community.glideapps.com/u/Darren_Alderman)
#### Post date: [April 19, 2021, 7:03pm UTC](https://community.glideapps.com/t/calculate-and-display-users-age-from-date-of-birth/4049/8 "2021-04-19T19:03:11Z")

</div>

How to calculate _Age_ from _Date of Birth_…

> FLOOR((NOW - Date of Birth) / 365.25)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/a/4/a493d7adafc27ae76eb88a974cf16e72ebf9f6f0.png)

---

<div class="post-metadata">

### Author: ![Mishta\_P](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mishta_p/32/16900_2.png) [@Mishta\_P](https://community.glideapps.com/u/Mishta_P)
#### Post date: [April 19, 2021, 9:39pm UTC](https://community.glideapps.com/t/calculate-and-display-users-age-from-date-of-birth/4049/9 "2021-04-19T21:39:34Z")

</div>

You need to divide by 365.25 to cover leap years.

---

<div class="post-metadata">

### Author: ![Jim\_McIntosh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jim_mcintosh/32/19235_2.png) [@Jim\_McIntosh](https://community.glideapps.com/u/Jim_McIntosh)
#### Post date: [April 22, 2021, 2:21pm UTC](https://community.glideapps.com/t/calculate-and-display-users-age-from-date-of-birth/4049/10 "2021-04-22T14:21:32Z")

</div>

I did a quick test and I believe that the date-time algorithm used by glide is leap year aware. I don’t believe you need to add the 1/4 year (365.25). I calculated age comparing a DoB of 2/28/2000 and 3/1/2000 vs the next leap year of 2/29/2024 and did the calculation with / 365 and / 365.25 and the result was the same to 4 places (24.0000 yo)

---

<div class="post-metadata">

### Author: ![Mishta\_P](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mishta_p/32/16900_2.png) [@Mishta\_P](https://community.glideapps.com/u/Mishta_P)
#### Post date: [April 22, 2021, 2:46pm UTC](https://community.glideapps.com/t/calculate-and-display-users-age-from-date-of-birth/4049/11 "2021-04-22T14:46:58Z")

</div>

Ah, that is rather interesting. Thanks for looking into that. I’ll have a play later.

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [April 22, 2021, 3:01pm UTC](https://community.glideapps.com/t/calculate-and-display-users-age-from-date-of-birth/4049/12 "2021-04-22T15:01:59Z")

</div>

> [@Jim\_McIntosh](#):
>
> I did a quick test and I believe that the date-time algorithm used by glide is leap year aware. I don’t believe you need to add the 1/4 year (365.25). I calculated age comparing a DoB of 2/28/2000 and 3/1/2000 vs the next leap year of 2/29/2024 and did the calculation with / 365 and / 365.25 and the result was the same to 4 places (24.0000 yo)

um… did you by chance use the same formula that @Darren_Alderman posted? (ie. with the `FLOOR` function included?)

Floor rounds down to the nearest integer value, so the result is as expected. Here is what it looks like without using floor:

![Screen Shot 2021-04-22 at 11.01.11 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/8/3/83b5403b49370f8c59602c5142e28eda24e52c53.png)

---

<div class="post-metadata">

### Author: ![Jim\_McIntosh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jim_mcintosh/32/19235_2.png) [@Jim\_McIntosh](https://community.glideapps.com/u/Jim_McIntosh)
#### Post date: [April 26, 2021, 2:52pm UTC](https://community.glideapps.com/t/calculate-and-display-users-age-from-date-of-birth/4049/13 "2021-04-26T14:52:28Z")

</div>

You are right. Good catch.

---

<div class="post-metadata">

### Author: ![True578](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/true578/32/30930_2.png) [@True578](https://community.glideapps.com/u/True578)
#### Post date: [November 28, 2021, 1:51pm UTC](https://community.glideapps.com/t/calculate-and-display-users-age-from-date-of-birth/4049/14 "2021-11-28T13:51:21Z")

</div>

> [@Darren\_Alderman](#):
>
> FLOOR((NOW - Date of Birth) / 365.25)

Thank you!!! This is simple, clean, and works perfectly. Had it implemented and functioning in 2 min. Thank you so much or sharing this solution 🤩

---

<div class="post-metadata">

### Author: ![david](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/david/32/62831_2.png) [@david](https://community.glideapps.com/u/david)
#### Post date: [June 12, 2022, 2:22pm UTC](https://community.glideapps.com/t/calculate-and-display-users-age-from-date-of-birth/4049/16 "2022-06-12T14:22:44Z")

</div>

We have a new plug-in for this: [Date Difference column • Glide](https://www.glideapps.com/plugins/date-difference)

---

<div class="post-metadata">

### Author: ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)
#### Post date: [June 13, 2022, 2:22pm UTC](https://community.glideapps.com/t/calculate-and-display-users-age-from-date-of-birth/4049/17 "2022-06-13T14:22:54Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
