Using birthday to calculate age in months - in Excel

Hi,

I am entering a survey in to Excel and have run in to a problem. I would
like the person being interviewed to say the "birthdate" of her child.
Then I want to calculate the child's age in months (using the date of
interview) from that birthdate. Previously on this community board,
someone suggested using Excel functions to do so, but I can't seem to get
that to work since it would be referring to cells that are "names" rather
than numbers at this point.

I have attached the file, please refer to lines 16-19.

Any suggestions? I would like the child's age to be in months (rounded to
the nearest hundredth).

Thanks so much!

Lisa

_26Sept2.xls (116 KB)

No need for an Excel function. Internal javarosa functions can be used. Use
a calculate field type then

for age in years, use: int((today() - ${BIRTH_DATE}) div 365.24)
for age in months, use: int((today() - ${BIRTH_DATE}) div 30.44)

With the assumption that system date is correct.

··· On Thursday, September 27, 2012, Lisa Zook wrote:

Hi,

I am entering a survey in to Excel and have run in to a problem. I would
like the person being interviewed to say the "birthdate" of her child.
Then I want to calculate the child's age in months (using the date of
interview) from that birthdate. Previously on this community board,
someone suggested using Excel functions to do so, but I can't seem to get
that to work since it would be referring to cells that are "names" rather
than numbers at this point.

I have attached the file, please refer to lines 16-19.

Any suggestions? I would like the child's age to be in months (rounded to
the nearest hundredth).

Thanks so much!

Lisa

--
Post: opendatakit@googlegroups.com <javascript:_e({}, 'cvml',
'opendatakit@googlegroups.com');>
Unsubscribe: opendatakit+unsubscribe@googlegroups.com <javascript:_e({},
'cvml', 'opendatakit%2Bunsubscribe@googlegroups.com');>
Options: http://groups.google.com/group/opendatakit?hl=en

1 Like

you can also solve your problem by calling the function. To see detail please click the link below

Hi there,

Thank you for your response. When I do this, I am not getting anything to
calculate.

Please see line 16 (the calculate line) and then line 17, where i ask for
it to display that calculation. Currently, nothing displays.

Any suggestions?

_27Sept.xls (126 KB)

··· On Thursday, September 27, 2012 1:35:55 AM UTC-7, ニコノコ wrote:

No need for an Excel function. Internal javarosa functions can be used.
Use a calculate field type then

for age in years, use: int((today() - ${BIRTH_DATE}) div 365.24)
for age in months, use: int((today() - ${BIRTH_DATE}) div 30.44)

With the assumption that system date is correct.

On Thursday, September 27, 2012, Lisa Zook wrote:

Hi,

I am entering a survey in to Excel and have run in to a problem. I would
like the person being interviewed to say the "birthdate" of her child.
Then I want to calculate the child's age in months (using the date of
interview) from that birthdate. Previously on this community board,
someone suggested using Excel functions to do so, but I can't seem to get
that to work since it would be referring to cells that are "names" rather
than numbers at this point.

I have attached the file, please refer to lines 16-19.

Any suggestions? I would like the child's age to be in months (rounded
to the nearest hundredth).

Thanks so much!

Lisa

--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en

you should use "div" and not "/" for division operations. See my example.

··· On Friday, September 28, 2012, Lisa Zook wrote:

Hi there,

Thank you for your response. When I do this, I am not getting anything to
calculate.

Please see line 16 (the calculate line) and then line 17, where i ask for
it to display that calculation. Currently, nothing displays.

Any suggestions?

On Thursday, September 27, 2012 1:35:55 AM UTC-7, ニコノコ wrote:

No need for an Excel function. Internal javarosa functions can be used.
Use a calculate field type then

for age in years, use: int((today() - ${BIRTH_DATE}) div 365.24)
for age in months, use: int((today() - ${BIRTH_DATE}) div 30.44)

With the assumption that system date is correct.

On Thursday, September 27, 2012, Lisa Zook wrote:

Hi,

I am entering a survey in to Excel and have run in to a problem. I
would like the person being interviewed to say the "birthdate" of her
child. Then I want to calculate the child's age in months (using the date
of interview) from that birthdate. Previously on this community board,
someone suggested using Excel functions to do so, but I can't seem to get
that to work since it would be referring to cells that are "names" rather
than numbers at this point.

I have attached the file, please refer to lines 16-19.

Any suggestions? I would like the child's age to be in months (rounded
to the nearest hundredth).

Thanks so much!

Lisa

--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@**googlegroups.com
Options: http://groups.google.com/**group/opendatakit?hl=enhttp://groups.google.com/group/opendatakit?hl=en

--
Post: opendatakit@googlegroups.com <javascript:_e({}, 'cvml',
'opendatakit@googlegroups.com');>
Unsubscribe: opendatakit+unsubscribe@googlegroups.com <javascript:_e({},
'cvml', 'opendatakit%2Bunsubscribe@googlegroups.com');>
Options: http://groups.google.com/group/opendatakit?hl=en

Thanks you solve my problem...

··· On Thursday, September 27, 2012 2:05:55 PM UTC+5:30, ニコノコ wrote: > No need for an Excel function. Internal javarosa functions can be used. Use a calculate field type then > for age in years, use: int((today() - ${BIRTH_DATE}) div 365.24) > > for age in months, use: int((today() - ${BIRTH_DATE}) div 30.44) > > With the assumption that system date is correct. > > > > On Thursday, September 27, 2012, Lisa Zook wrote: > > Hi, > > > > I am entering a survey in to Excel and have run in to a problem. I would like the person being interviewed to say the "birthdate" of her child. Then I want to calculate the child's age in months (using the date of interview) from that birthdate. Previously on this community board, someone suggested using Excel functions to do so, but I can't seem to get that to work since it would be referring to cells that are "names" rather than numbers at this point. > > > > > I have attached the file, please refer to lines 16-19. > > > > Any suggestions? I would like the child's age to be in months (rounded to the nearest hundredth). > > > > Thanks so much! > > > > Lisa > > > > > > > > > -- > > Post: opendatakit@googlegroups.com > > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > > Options: http://groups.google.com/group/opendatakit?hl=en

I was not aware int() was a supported function in javarosa. Was support
added by ODK or is it accidentally working (because it works natively in
java or something)?

··· On Thursday, September 27, 2012 6:50:20 PM UTC-6, ニコノコ wrote: > > you should use "div" and not "/" for division operations. See my example. > > On Friday, September 28, 2012, Lisa Zook wrote: > >> Hi there, >> >> Thank you for your response. When I do this, I am not getting anything >> to calculate. >> >> Please see line 16 (the calculate line) and then line 17, where i ask for >> it to display that calculation. Currently, nothing displays. >> >> Any suggestions? >> >> >> On Thursday, September 27, 2012 1:35:55 AM UTC-7, ニコノコ wrote: >> >>> No need for an Excel function. Internal javarosa functions can be used. >>> Use a calculate field type then >>> >>> for age in years, use: int((today() - ${BIRTH_DATE}) div 365.24) >>> for age in months, use: int((today() - ${BIRTH_DATE}) div 30.44) >>> >>> With the assumption that system date is correct. >>> >>> On Thursday, September 27, 2012, Lisa Zook wrote: >>> >>>> Hi, >>>> >>>> I am entering a survey in to Excel and have run in to a problem. I >>>> would like the person being interviewed to say the "birthdate" of her >>>> child. Then I want to calculate the child's age in months (using the date >>>> of interview) from that birthdate. Previously on this community board, >>>> someone suggested using Excel functions to do so, but I can't seem to get >>>> that to work since it would be referring to cells that are "names" rather >>>> than numbers at this point. >>>> >>>> I have attached the file, please refer to lines 16-19. >>>> >>>> Any suggestions? I would like the child's age to be in months (rounded >>>> to the nearest hundredth). >>>> >>>> Thanks so much! >>>> >>>> Lisa >>>> >>>> >>>> >>>> -- >>>> Post: opendatakit@googlegroups.com >>>> Unsubscribe: opendatakit+unsubscribe@**googlegroups.com >>>> Options: http://groups.google.com/**group/opendatakit?hl=en >>>> >>> -- >> Post: opendatakit@googlegroups.com >> Unsubscribe: opendatakit+unsubscribe@googlegroups.com >> Options: http://groups.google.com/group/opendatakit?hl=en >> >

I've updated the documentation at

Note that the source code, linked off that page, is the best resource for
determining exactly what functions are or are not available.

··· On Tue, Oct 2, 2012 at 9:28 AM, Martijn van de Rijdt wrote:

I was not aware int() was a supported function in javarosa. Was support
added by ODK or is it accidentally working (because it works natively in
java or something)?

On Thursday, September 27, 2012 6:50:20 PM UTC-6, ニコノコ wrote:

you should use "div" and not "/" for division operations. See my example.

On Friday, September 28, 2012, Lisa Zook wrote:

Hi there,

Thank you for your response. When I do this, I am not getting anything
to calculate.

Please see line 16 (the calculate line) and then line 17, where i ask
for it to display that calculation. Currently, nothing displays.

Any suggestions?

On Thursday, September 27, 2012 1:35:55 AM UTC-7, ニコノコ wrote:

No need for an Excel function. Internal javarosa functions can be used.
Use a calculate field type then

for age in years, use: int((today() - ${BIRTH_DATE}) div 365.24)
for age in months, use: int((today() - ${BIRTH_DATE}) div 30.44)

With the assumption that system date is correct.

On Thursday, September 27, 2012, Lisa Zook wrote:

Hi,

I am entering a survey in to Excel and have run in to a problem. I
would like the person being interviewed to say the "birthdate" of her
child. Then I want to calculate the child's age in months (using the date
of interview) from that birthdate. Previously on this community board,
someone suggested using Excel functions to do so, but I can't seem to get
that to work since it would be referring to cells that are "names" rather
than numbers at this point.

I have attached the file, please refer to lines 16-19.

Any suggestions? I would like the child's age to be in months
(rounded to the nearest hundredth).

Thanks so much!

Lisa

--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/**group**/opendatakit?hl=enhttp://groups.google.com/group/opendatakit?hl=en

--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@**googlegroups.com
Options: http://groups.google.com/**group/opendatakit?hl=enhttp://groups.google.com/group/opendatakit?hl=en

--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

Thanks Mitch!

I used this as my guide for enketo (the webform client in formhub):
https://bitbucket.org/javarosa/javarosa/wiki/xform-jr-compat and therefore
seem to have missed out on a few functions in the XPath evaluator. I will
need to add them asap.

Cheers,
Martijn

··· On Thursday, October 4, 2012 2:33:34 PM UTC-6, Mitch wrote: > > I've updated the documentation at > http://opendatakit.org/help/form-design/binding/ > > Note that the source code, linked off that page, is the best resource for > determining exactly what functions are or are not available. > > On Tue, Oct 2, 2012 at 9:28 AM, Martijn van de Rijdt <mri...@gmail.com wrote: > >> I was not aware int() was a supported function in javarosa. Was support >> added by ODK or is it accidentally working (because it works natively in >> java or something)? >> >> >> On Thursday, September 27, 2012 6:50:20 PM UTC-6, ニコノコ wrote: >>> >>> you should use "div" and not "/" for division operations. See my example. >>> >>> On Friday, September 28, 2012, Lisa Zook wrote: >>> >>>> Hi there, >>>> >>>> Thank you for your response. When I do this, I am not getting anything >>>> to calculate. >>>> >>>> Please see line 16 (the calculate line) and then line 17, where i ask >>>> for it to display that calculation. Currently, nothing displays. >>>> >>>> Any suggestions? >>>> >>>> >>>> On Thursday, September 27, 2012 1:35:55 AM UTC-7, ニコノコ wrote: >>>> >>>>> No need for an Excel function. Internal javarosa functions can be >>>>> used. Use a calculate field type then >>>>> >>>>> for age in years, use: int((today() - ${BIRTH_DATE}) div 365.24) >>>>> for age in months, use: int((today() - ${BIRTH_DATE}) div 30.44) >>>>> >>>>> With the assumption that system date is correct. >>>>> >>>>> On Thursday, September 27, 2012, Lisa Zook wrote: >>>>> >>>>>> Hi, >>>>>> >>>>>> I am entering a survey in to Excel and have run in to a problem. I >>>>>> would like the person being interviewed to say the "birthdate" of her >>>>>> child. Then I want to calculate the child's age in months (using the date >>>>>> of interview) from that birthdate. Previously on this community board, >>>>>> someone suggested using Excel functions to do so, but I can't seem to get >>>>>> that to work since it would be referring to cells that are "names" rather >>>>>> than numbers at this point. >>>>>> >>>>>> I have attached the file, please refer to lines 16-19. >>>>>> >>>>>> Any suggestions? I would like the child's age to be in months >>>>>> (rounded to the nearest hundredth). >>>>>> >>>>>> Thanks so much! >>>>>> >>>>>> Lisa >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> Post: opendatakit@googlegroups.com >>>>>> Unsubscribe: opendatakit+unsubscribe@**google**groups.com >>>>>> Options: http://groups.google.com/**group**/opendatakit?hl=en >>>>>> >>>>> -- >>>> Post: opendatakit@googlegroups.com >>>> Unsubscribe: opendatakit+unsubscribe@**googlegroups.com >>>> Options: http://groups.google.com/**group/opendatakit?hl=en >>>> >>> -- >> Post: opend...@googlegroups.com >> Unsubscribe: opendatakit...@googlegroups.com >> Options: http://groups.google.com/group/opendatakit?hl=en >> > > > > -- > Mitch Sundt > Software Engineer > University of Washington > mitche...@gmail.com >