Is that possible; More than one Formula

  • Thread starter Khalid A. Al-Otaibi
  • Start date
K

Khalid A. Al-Otaibi

I don't know whay I can't inculde more than one formula in one cell.

DATA-A DATA-B RESULT

1/31/2010 1/31/2010 Valid
2/2/2008 2/2/2008 Expired
6/6/2010 6/6/2010 Enrolled
(Blank) (Blank) Not Enrolled
N/A N/A N/A

If the date is in the future in Column (B) the result will be [Valid].
If the date is in the past in Column (B) the result will be [Expired].
If the Cell in the Column (A)in Future the result will be [Enrolled]
If the Cell in the Column (A) is Blank, the result will be Blank ("").
If the Cell in the Column (A) is the word (N/A), the result will be [N/A].
 
S

Sheeloo

You can but with your logic either the first one will be true or the second
one...

If you correct your logic then you will need something like
=IF(B2>=TODAY(),"Valid",IF(B2<TODAY(),"Expired",IF(A2>=TODAY(),"Enrolled",IF(A2="","",IF(A2="N/A","N/A")))))
 
J

Joe User

Sheeloo said:
=IF(B2>=TODAY(),"Valid",IF(B2<TODAY(),"Expired",
IF(A2>=TODAY(),"Enrolled",IF(A2="","",IF(A2="N/A","N/A")))))

Since B2 can only be >=TODAY or <TODAY, your formula will only return
"Valid" or "Expired".

Moreover, since text>=numeric is always true(!), if A2 contains "N/A", your
formula will return "Enrolled".

Finally, if you corrected all that, your formula will return FALSE if A2 is
none of the expected values ("" or "N/A" or a date).


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

Sheeloo said:
You can but with your logic either the first one will be true or the
second
one...

If you correct your logic then you will need something like
=IF(B2>=TODAY(),"Valid",IF(B2<TODAY(),"Expired",IF(A2>=TODAY(),"Enrolled",IF(A2="","",IF(A2="N/A","N/A")))))

Khalid A. Al-Otaibi said:
I don't know whay I can't inculde more than one formula in one cell.

DATA-A DATA-B RESULT

1/31/2010 1/31/2010 Valid
2/2/2008 2/2/2008 Expired
6/6/2010 6/6/2010 Enrolled
(Blank) (Blank) Not Enrolled
N/A N/A N/A

If the date is in the future in Column (B) the result will be [Valid].
If the date is in the past in Column (B) the result will be [Expired].
If the Cell in the Column (A)in Future the result will be [Enrolled]
If the Cell in the Column (A) is Blank, the result will be Blank ("").
If the Cell in the Column (A) is the word (N/A), the result will be
[N/A].
 
J

Joe User

Khalid A. Al-Otaibi said:
If the date is in the future in Column (B) the result will be [Valid].
If the date is in the past in Column (B) the result will be [Expired].
If the Cell in the Column (A)in Future the result will be [Enrolled]
If the Cell in the Column (A) is Blank, the result will be Blank ("").
If the Cell in the Column (A) is the word (N/A), the result will be [N/A].

Your rules are not mutually exclusive. Note that a date in B can only be in
the future or in the past (assuming today is one or the other, your choice).
So one of your first two conditions will always be true, and you will never
look at A.

I will assume that if A and B are dates, A <= B is expected to be true.
Also, I will assume that your list of is exhaustive; that is, those are the
only expected values, and you are not trying to recognize unexpected values.
In that case, the simplest formulation is:

=if(A2="", "", if(A2="N/A", "N/A", if(A2>TODAY(), "Enrolled",
if(B2<=TODAY(), "Expired", "Valid"))))

If you would like to add some error-checking:

=if(and(A2="",B2=""), "", if(and(A2="N/A",B2="N/A"), "N/A",
if(and(isnumber(A2),isnumber(B2),A2<=B2),
if(A2>TODAY(), "Enrolled", if(B2<=TODAY(), "Expired", "Valid")),
"ERROR")))

I believe that catches all mistakes except when A2 or B2 contains an Excel
error (e.g. #VALUE or #REF).


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

Khalid A. Al-Otaibi said:
I don't know whay I can't inculde more than one formula in one cell.

DATA-A DATA-B RESULT

1/31/2010 1/31/2010 Valid
2/2/2008 2/2/2008 Expired
6/6/2010 6/6/2010 Enrolled
(Blank) (Blank) Not Enrolled
N/A N/A N/A

If the date is in the future in Column (B) the result will be [Valid].
If the date is in the past in Column (B) the result will be [Expired].
If the Cell in the Column (A)in Future the result will be [Enrolled]
If the Cell in the Column (A) is Blank, the result will be Blank ("").
If the Cell in the Column (A) is the word (N/A), the result will be [N/A].
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top