Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 180
Default Exclude blank data from formula calculation

I have a formula =YEAR($J$1)-YEAR(C2) calculating age from date of birth.

However some of my entries do not have an entry for date of birth, so their
'age' ends up as being (for example) 108.

Is there a way of making sure the formula does not calculate these ages?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Exclude blank data from formula calculation

Donna,


Your formula is incorrect for working out age and as an example put
=Today() in J1
31/12/2007 in C2

Your formula will tell you that person is 1 yr old which clearly someone
born on that day is only 4 months old.

Use datedif instead and to get around the 108 problem check the cells are
populated.

=IF(AND(C2<"",J1<""),DATEDIF(C2,$J$1,"y"),"")

Mike

"Donna" wrote:

I have a formula =YEAR($J$1)-YEAR(C2) calculating age from date of birth.

However some of my entries do not have an entry for date of birth, so their
'age' ends up as being (for example) 108.

Is there a way of making sure the formula does not calculate these ages?

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Exclude blank data from formula calculation

=IF(C2="","no record of birthdate",YEAR($J$1)-YEAR(C2))


Gord Dibben MS Excel MVP

On Mon, 14 Apr 2008 02:57:00 -0700, Donna
wrote:

I have a formula =YEAR($J$1)-YEAR(C2) calculating age from date of birth.

However some of my entries do not have an entry for date of birth, so their
'age' ends up as being (for example) 108.

Is there a way of making sure the formula does not calculate these ages?

Thanks


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,651
Default Exclude blank data from formula calculation

But of course =YEAR($J$1)-YEAR(C2) doesn't calculate current age, it
calculates the age attained during that calendar year. For someone born in
December 2000, that formula would give their age as 8, whereas currently
they are 7. DATEDIF(C2,$J$1,"y") might be better, & can be nested in a test
for C2 not being blank as Gord suggested.
--
David Biddulph

"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
=IF(C2="","no record of birthdate",YEAR($J$1)-YEAR(C2))


Gord Dibben MS Excel MVP

On Mon, 14 Apr 2008 02:57:00 -0700, Donna

wrote:

I have a formula =YEAR($J$1)-YEAR(C2) calculating age from date of birth.

However some of my entries do not have an entry for date of birth, so
their
'age' ends up as being (for example) 108.

Is there a way of making sure the formula does not calculate these ages?

Thanks




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exclude Cell from Calculation KenCQE Excel Discussion (Misc queries) 2 March 21st 07 12:05 PM
How do I set up a calculation to exclude weekends? Ken Proj mgr Excel Worksheet Functions 6 February 8th 06 03:49 PM
Date Calculation to exclude weekends Vim Excel Worksheet Functions 2 January 24th 06 03:58 PM
Exclude non-numeric data from calculation jostermi Excel Worksheet Functions 1 August 23rd 05 08:54 PM
calculation to exclude weekends Need2Know Excel Worksheet Functions 6 July 14th 05 10:01 PM


All times are GMT +1. The time now is 05:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"