View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
joeu2004 joeu2004 is offline
external usenet poster
 
Posts: 2,059
Default Problem with "IF" function

Errata....

I wrote:
Generally, "2 months before" results in a difference
of 59 to 62 days, with an average of 61 days.
"2 months before" is 60 days in only 3 of 24 months
(a normal year and a leap year).


More correctly, "2 months before" results in 59 to 62 days, with an average
of 60.92 days. "2 months before" is 60 days in 61 of 731 instances (8.34%)
in 2 years, a normal year and a leap year. "2 months before" is 59 days in
59 instances (8.07%), 61 days in 490 instances (67.03%), and 62 days in 121
instances (16.55%).


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

"JoeU2004" wrote in message
...
"Pete_UK" wrote:
In subtracting 2 from D4, you are only subtracting 2 days.
Change this to 60 (or however many days you think there are
in 2 months).


I would not assume that "2 months" is the same a 60 days or any constant
number of days. However, that might depend on OP's intent and the laws of
the OP's jurisdiction.

In the US, "2 months" is not the same as "60 days" (or any other constant)
for legal purposes. "2 months" is usually defined in regulations as the
same day of the month or the end of the month if the same day does not
exist. For example, Feb 28 or Feb 29 is 2 months before Apr 30, depending
on the year. Generally, "2 months before" results in a difference of 59
to 62 days, with an average of 61 days. "2 months before" is 60 days in
only 3 of 24 months (a normal year and a leap year).


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

"Pete_UK" wrote in message
...
In subtracting 2 from D4, you are only subtracting 2 days. Change this
to 60 (or however many days you think there are in 2 months).

Hope this helps.

Pete

On Aug 3, 9:38 am, Torfinn Brokke
wrote:
Hello!

I've got a question for you Excel experts out there. I'm trying to make a
form to keep track of expiry dates. I want to be able to put in a date
and
have the form return "VALID" if today is more than two months before the
expiry date, "PENDING" if today is less than two months before the expiry
date, and "EXPIRED" if today has passed the expiry date.

I've been using the following function for this:

=IF(E6$D$4;"VALID";IF(E6$D$4-2;"PENDING";IF(E6<$D$4;"EXPIRED")))

(D4 contains the "TODAY()" function, and E6 is the date for the item that
I've put in manually plus the number of months until expiry for the given
item.)

This works for "VALID" and "EXPIRED", but not for "PENDING". However,
until
earlier today it worked perfectly, but when I put up the exact same
formula
after rearranging some cells, I can't get it to give the output
"PENDING".

It would be much appreciated if somebody could help me figure out what is
wrong.

Thanks in advance!