Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
PAL PAL is offline
external usenet poster
 
Posts: 200
Default Cycle Time if in a Specific Year

I am trying to calculate the time between 2 dates, if the latter date
occurred in 2007. Here is where I was going, but it doesn't seem to work.

=IF(H2=YEAR(L2),(H2-E2),"") where L2 has the value 2007.

Also, how would it change if I wanted H2 beween 2 years, ie. 2004-2006.

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,651
Default Cycle Time if in a Specific Year

If you are struggling to see what is happening in a formula, you could
always break it down into manageable chunks until you can see what's going
on.

If you look at =YEAR(2007) it will return the value 1905, because when you
treat the number 2007 as a date (by using it as the input to the YEAR
function) then it is interpreted as 29th June 1905 (2007 days after the
beginning of 1900). If you'd forgotten what the YEAR function does, you can
look it up in Excel help.
If you are trying to test whether a date in H2 is in 2007, it looks as if
you want to change your formula to
=IF(YEAR(H2)=L2,H2-E2,"")
If you want to test whether H2 falls within your 3 year range (2004 to
2006), then you could use
=IF(AND(YEAR(H2)=2004,YEAR(H2)<=2006),H2-E2,"")
[or you could put 2004 and 2006 in cells and use the relevant cell
references in the formula, as you did for 2007 in L2]
--
David Biddulph

"PAL" wrote in message
...
I am trying to calculate the time between 2 dates, if the latter date
occurred in 2007. Here is where I was going, but it doesn't seem to work.

=IF(H2=YEAR(L2),(H2-E2),"") where L2 has the value 2007.

Also, how would it change if I wanted H2 beween 2 years, ie. 2004-2006.

Thanks.



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Cycle Time if in a Specific Year

Do H2 and E2 contain dates?

If so, try it like this:

=IF(YEAR(H2)=L2,H2-E2,"")

--
Biff
Microsoft Excel MVP


"PAL" wrote in message
...
I am trying to calculate the time between 2 dates, if the latter date
occurred in 2007. Here is where I was going, but it doesn't seem to work.

=IF(H2=YEAR(L2),(H2-E2),"") where L2 has the value 2007.

Also, how would it change if I wanted H2 beween 2 years, ie. 2004-2006.

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
cycle time out of range error Access lightweight Excel Discussion (Misc queries) 1 January 15th 08 04:58 PM
Time Cycle Antonio Excel Discussion (Misc queries) 7 December 3rd 07 11:01 PM
Format Help BOLD year in a specific vehicle application Column mobile electronics installer Excel Worksheet Functions 1 February 28th 07 08:48 AM
How do I keep result from 1 iteration cycle to use in next cycle? sgl8akm Excel Discussion (Misc queries) 0 July 27th 06 08:28 PM
entering items on specific dates of year Puzzled Excel Discussion (Misc queries) 0 March 11th 06 03:32 PM


All times are GMT +1. The time now is 05:27 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"