Calculate age

Bonjour
Je dispose d’informations sur le jour, le mois, l’année et l’âge
je souhaite avoir une variable qui va me calculer l’âge des individus
Merci
Calcul de l’age.xlsx (10.3 KB)

Bonsoir @Zeubien
There have been previous discussions around the same issue which you can find in the topic below. I believe this will solve your issue.

Stephane

1 Like

Hello;
Here is another discussion.

Feel free to use the search function of the forum to find more, e.g. with token “calculate age”

2 Likes

Bonjour, merci pour la promptitude.
Cependant, mon souci demeure.
En fait dans le questionnaire, je dispose des informations suivantes: jour, mois et année. Je souhaite calculer l’âge à partir de ces trois variables distinctes comme dans le fichier que je joint.
Merci
Calcul de l’age.xlsx (10.2 KB)

Pourqoui ne pas outilser calendar type. (and Required No)? And a rule/hint like if month not known, take June. If day not known take 15.

With our design, you will need to make a lot of checks against invalid calendar dates, like 31 November or 29 February 2021.

To convert, you could concat your part to the KoBo/ODK standard date text format yyyy-mm-dd and convert the string with date () function. (See XLSForm documentation).
date text format).

Before you would also need to define calculation for a missing element, e.g. if no day take 15. Date types cannot have missing elements.

1 Like