Figuring ages and calculating totals on a spread sheet

D

Dagonini

I am having a hard time wrapping my mind around what way I should start
working up some code to separate people by age on a spreadsheet.

I will have a list of say 10,000 people. Column H is date of birth. I
need to put those people into their age groups as totals on a second
page.

For example:

the age bands are
0-29
30-34
35-39
40-44
50-99

The mind warping problem is my if statement. I figure somehow I have
to do an if a person's age is between 0 and 29 then put in B2 on
sheet2. But how would I tell it to calculate it? This is something
that would be used once a month so would it be something like if
today's date minus date in column H = 30,31,32,33, or 34 then move to
sheet2 B3?

I have this feeling I am making this way more difficult than I need to
but I can't think of a simple way to do it.

Thanks in advance
Mary
 
J

Jim Jackson

On the data sheet use this formula for determing ages
=($A$1-H2)/365 ' A1 has formula "=today()"
'You can alter this to your needs, of course.

On the summary sheet use this formula
=COUNTIF(Sheet1!H2:H10000,"<=29") '
=IF(Sheet1!H2:H10000 >29,(COUNTIF(Sheet1!H2:H10000,"<=34")),"")
 
J

Jim Jackson

I forgot to remind you to change the cell references to suit your situation.
Of course you knew that anyway.
 
T

Tom Ogilvy

How accurate do you have to be:

=sumproduct(--(((date-H1:H50)/365.25)>=30),--(((date-H1:H50)/365.25)<35))

should do 30 to 34
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top