Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 13
Default Problem with "IF" function

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!
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,856
Default Problem with "IF" function

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!


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 13
Default Problem with "IF" function

Hello, Pete!

Thank you very much! I just tried your suggestion, but for some reason it
still doesn't seem to work... Could there be something wrong with the formula
I've put in?


Best regards,
Torfinn


"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).

Hope this helps.

Pete

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,059
Default Problem with "IF" function

"Torfinn Brokke" wrote:
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.
[....]
=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


If E6 contains a complete date (year, month, day) just as D4 does, then the
first part of your formula (E6D4) fails to take the two-month criterion
into account, the second part (E6D4-2) is subtracting 2 __days__, not 2
months. The correct formula to use is"

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

Note: This returns "PENDING" if today is less than __or_equal__ to two
months before the expiration date.

If you get a #NAME error, see the help page for EOMONTH. If you cannot or
do not want to load the Analysis ToolPak, replace EOMONTH(E6;-2) with
DATE(year(E6);month(E6)-2;day(E6)).

I have not checked to see how the suggested formula behaves when today or
the expiration date is Feb 29 or the 31st of some month.


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

"Torfinn Brokke" wrote in message
...
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!


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 13
Default Problem with "IF" function

Well, I just tested some more, and I just found out that it DOES work, but it
works the wrong way, i.e. it gives the output "PENDING" for the first 60 days
AFTER the expiry date, not before as it is supposed to.

What could be the reason for this?


Best regards,
Torfinn


"Torfinn Brokke" wrote:

Hello, Pete!

Thank you very much! I just tried your suggestion, but for some reason it
still doesn't seem to work... Could there be something wrong with the formula
I've put in?


Best regards,
Torfinn



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,059
Default Problem with "IF" function

Errata....

I should have written EDATE, not EOMONTH.


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

"JoeU2004" wrote in message
...
"Torfinn Brokke" wrote:
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.
[....]
=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


If E6 contains a complete date (year, month, day) just as D4 does, then
the first part of your formula (E6D4) fails to take the two-month
criterion into account, the second part (E6D4-2) is subtracting 2
__days__, not 2 months. The correct formula to use is"

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

Note: This returns "PENDING" if today is less than __or_equal__ to two
months before the expiration date.

If you get a #NAME error, see the help page for EOMONTH. If you cannot or
do not want to load the Analysis ToolPak, replace EOMONTH(E6;-2) with
DATE(year(E6);month(E6)-2;day(E6)).

I have not checked to see how the suggested formula behaves when today or
the expiration date is Feb 29 or the 31st of some month.


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

"Torfinn Brokke" wrote in
message ...
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!



  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Problem with "IF" function


try
=IF(E6$D$4+60,"VALID",IF(E6$D$4,"PENDING","EXPIR ED"))


--
p45cal

*p45cal*
------------------------------------------------------------------------
p45cal's Profile: http://www.thecodecage.com/forumz/member.php?userid=558
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=121905

  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 13
Default Problem with "IF" function

JoeU2004,

Thank you very much! That seems to work like a charm!


Best regards,
Torfinn


"JoeU2004" wrote:

"Torfinn Brokke" wrote:
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.
[....]
=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


If E6 contains a complete date (year, month, day) just as D4 does, then the
first part of your formula (E6D4) fails to take the two-month criterion
into account, the second part (E6D4-2) is subtracting 2 __days__, not 2
months. The correct formula to use is"

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

Note: This returns "PENDING" if today is less than __or_equal__ to two
months before the expiration date.

If you get a #NAME error, see the help page for EOMONTH. If you cannot or
do not want to load the Analysis ToolPak, replace EOMONTH(E6;-2) with
DATE(year(E6);month(E6)-2;day(E6)).

I have not checked to see how the suggested formula behaves when today or
the expiration date is Feb 29 or the 31st of some month.

  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,059
Default Problem with "IF" function

"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!


  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
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!



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
Text "comparison" operator for "contains" used in an "IF" Function Pawaso Excel Worksheet Functions 4 April 4th 23 11:35 AM
=IF function, reference problem to "text strings" in Data Validati Jim D.[_2_] Excel Discussion (Misc queries) 2 July 17th 09 08:56 AM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
problem: "You entered too many arguments for this function" Sam Giddy Excel Worksheet Functions 1 August 7th 08 12:20 AM
problem with Linking workbooks via "copy" and "paste link" Arkitek Excel Discussion (Misc queries) 0 December 19th 06 10:03 PM


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