Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 9
Default Modifying date formulas

Hi,

I have built a spread sheet and one of the things I'm measuring is
targets for completion of an event, the target is measured in weeks from
an entered start date to an entered completion date, I have used the
following formula, based on K2 as the start date and Z2 as the
completion date:

=DATEDIF($K2,$Z2,"d")/7

This works fine however now I want to modify the formula to say that if
the start date entered is equal to or before (<=) 31/04/2009 (39934)
then use 31/04/2009 (39934) as the start date if its greater than ()
that then use the date as entered in K2, which gives:

=IF($K2<=39934, 39934, $K2)

So the question is how do I combine them?

--
Steve
  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 5,651
Default Modifying date formulas

On Sun, 19 Jul 2009 11:45:33 +0100, Steve wrote:

Hi,

I have built a spread sheet and one of the things I'm measuring is
targets for completion of an event, the target is measured in weeks from
an entered start date to an entered completion date, I have used the
following formula, based on K2 as the start date and Z2 as the
completion date:

=DATEDIF($K2,$Z2,"d")/7

This works fine however now I want to modify the formula to say that if
the start date entered is equal to or before (<=) 31/04/2009 (39934)
then use 31/04/2009 (39934) as the start date if its greater than ()
that then use the date as entered in K2, which gives:

=IF($K2<=39934, 39934, $K2)

So the question is how do I combine them?

--
Steve


Comments. Excel stores dates as integers with 1= 1 Jan 1900 (or 2 Jan 1904)

1. Your original formula can be simplified:

=(EndDate-StartDate)/7

2. To set a particular StartDate as being the earliest:

=(EndDate-MAX(EarliestStartDate,StartDate))/7
--ron
  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 2,059
Default Modifying date formulas

"Steve" wrote:
=DATEDIF($K2,$Z2,"d")/7

This works fine however now I want to modify the
formula to say that if the start date entered is
equal to or before (<=) 31/04/2009 (39934) then
use 31/04/2009 (39934) as the start date if its
greater than () that then use the date as entered
in K2


First, no need to use DATEDIF to compute difference in days. Second, no
need to refer to dates by serial number; in fact, I would say it is a bad
idea (impossible to relate to).

Try:

=$Z2 - max($K2, date(2009,4,31))

Alternatively, you can write either of the following. But I think they are
deprecated because they depend on your computer's regional settings.

=$Z2 - max($K2, datevalue("31/04/2009"))

=$Z2 - max($K2, --"31/04/2009")


----- original message -----

"Steve" wrote in message
...
Hi,

I have built a spread sheet and one of the things I'm measuring is targets
for completion of an event, the target is measured in weeks from an
entered start date to an entered completion date, I have used the
following formula, based on K2 as the start date and Z2 as the completion
date:

=DATEDIF($K2,$Z2,"d")/7

This works fine however now I want to modify the formula to say that if
the start date entered is equal to or before (<=) 31/04/2009 (39934) then
use 31/04/2009 (39934) as the start date if its greater than () that
then use the date as entered in K2, which gives:

=IF($K2<=39934, 39934, $K2)

So the question is how do I combine them?

--
Steve


  #4   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 2,059
Default Modifying date formulas

Errata....

I forgot to divide by 7 to compute weeks. That should be obvious. But....

=($Z2 - max($K2, date(2009,4,31))) / 7


----- original message -----

"JoeU2004" wrote in message
...
"Steve" wrote:
=DATEDIF($K2,$Z2,"d")/7

This works fine however now I want to modify the
formula to say that if the start date entered is
equal to or before (<=) 31/04/2009 (39934) then
use 31/04/2009 (39934) as the start date if its
greater than () that then use the date as entered
in K2


First, no need to use DATEDIF to compute difference in days. Second, no
need to refer to dates by serial number; in fact, I would say it is a bad
idea (impossible to relate to).

Try:

=$Z2 - max($K2, date(2009,4,31))

Alternatively, you can write either of the following. But I think they
are deprecated because they depend on your computer's regional settings.

=$Z2 - max($K2, datevalue("31/04/2009"))

=$Z2 - max($K2, --"31/04/2009")


----- original message -----

"Steve" wrote in message
...
Hi,

I have built a spread sheet and one of the things I'm measuring is
targets for completion of an event, the target is measured in weeks from
an entered start date to an entered completion date, I have used the
following formula, based on K2 as the start date and Z2 as the completion
date:

=DATEDIF($K2,$Z2,"d")/7

This works fine however now I want to modify the formula to say that if
the start date entered is equal to or before (<=) 31/04/2009 (39934) then
use 31/04/2009 (39934) as the start date if its greater than () that
then use the date as entered in K2, which gives:

=IF($K2<=39934, 39934, $K2)

So the question is how do I combine them?

--
Steve



  #5   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 9
Default Modifying date formulas


Thank you both, all sorted and lessons learned.

--
Steve

Beware of all enterprises that require new clothes.
- Henry David Thoreau


  #6   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 5,651
Default Modifying date formulas

On Mon, 20 Jul 2009 07:55:58 +0100, Steve wrote:


Thank you both, all sorted and lessons learned.


Glad to help. Thanks for the feedback.
--ron
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
Protecting Cells from changing or modifying long formulas Loadmaster Excel Discussion (Misc queries) 2 July 22nd 08 09:34 PM
need help modifying a complex column of formulas [email protected] Excel Discussion (Misc queries) 12 October 27th 07 10:21 PM
Modifying data in excel containing 4000+ formulas [email protected] Excel Worksheet Functions 2 March 16th 07 01:14 PM
Modifying a footer date jim314 Excel Discussion (Misc queries) 5 October 26th 05 10:00 PM
Modifying sumif formulas. Hirsch Excel Worksheet Functions 4 June 17th 05 04:15 AM


All times are GMT +1. The time now is 05:35 AM.

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

About Us

"It's about Microsoft Excel"