Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 1
Default Adding dates in a IF Statement

OK, I need to use an IF statement to add a certain amount of time to a date.
Example..
Date cell is K4
IF hurdle is L4
formula is in M4

The way it needs to work is, if L4 = "Yes" then I need to add 7 years and 9 months to the date in K4. If not, I need it to add 9 years and 9 months to the date in K4.

Everything I try comes out with a "#VALUE!" error in the cell.
Here is one of the ways I tried it...
=IF(L4="Yes",K4+2465,K4+3560)

Note, K4 and M4 are both formatted as dates in the same configuration.
Any help would be awesome.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 621
Default Adding dates in a IF Statement

Should work........I tested and OK..........if the Date in K4 is a
real date.

If you format K4 to General what do you see in the cell?

Should be a 5 digit number.

February 15, 2012 will be 40954

Might be your date is text?

Re-enter.


Gord

On Wed, 15 Feb 2012 19:14:47 +0000, Inchman
wrote:


OK, I need to use an IF statement to add a certain amount of time to a
date.
Example..
Date cell is K4
IF hurdle is L4
formula is in M4

The way it needs to work is, if L4 = "Yes" then I need to add 7 years
and 9 months to the date in K4. If not, I need it to add 9 years and 9
months to the date in K4.

Everything I try comes out with a "#VALUE!" error in the cell.
Here is one of the ways I tried it...
=IF(L4="Yes",K4+2465,K4+3560)

Note, K4 and M4 are both formatted as dates in the same configuration.
Any help would be awesome.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 829
Default Adding dates in a IF Statement

"Inchman" wrote:
Date cell is K4

[....]
Everything I try comes out with a "#VALUE!" error in the cell.
Here is one of the ways I tried it...
=IF(L4="Yes",K4+2465,K4+3560)
Note, K4 and M4 are both formatted as dates in the same configuration.


The problem is: Excel does not recognize the form of your dates.
Therefore, it treats them as text. The format does not matter (well, as
long as it is not Text).

For example, on my computer, Excel recognizes 2/15/2012 as today's date. If
I enter 15/2/2012, Excel treats that as text.

The Regional and Language control panel determines what Excel recognizes as
a date.

Alternatively, you can use the DATE function to enter dates unambiguously.
For example, DATE(2012,2,15).

Inchman wrote:
if L4 = "Yes" then I need to add 7 years
and 9 months to the date in K4. If not, I need it to
add 9 years and 9 months to the date in K4.


I don't know on what planet 2465 is 7 years 9 months, but I am pretty sure
that is not Earth time :-). Even 3560 is dubious. (I have not tried all
possible interpretations.)

I suggest that you use DATE(7+YEAR(K4),7+MONTH(K4),DAY(K4)).

Of course, that presumes that you fix your problem with K4 first.


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
Adding a statement to several documents Newbee Excel Worksheet Functions 2 March 17th 08 04:41 PM
Adding OR conditions to IF-Then statement excelnut1954 Excel Programming 2 January 25th 06 08:38 PM
Adding a 3rd IF statement ?? yh73090[_5_] Excel Programming 3 October 17th 04 05:57 PM
Adding a 3rd IF statement ?? yh73090[_6_] Excel Programming 0 October 17th 04 04:50 AM
Adding SQL Select Statement Pepe[_2_] Excel Programming 1 January 29th 04 02:19 AM


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