#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Bob is offline
external usenet poster
 
Posts: 972
Default IF, OR, AND

If F2 = "m" or "m3" or "a" or "a3" or "ftm," and J2 is not blank, I want to
return a value of 1.

Can anyone kindly help?

Thanks,
Bob
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,355
Default IF, OR, AND

One way.

=IF(AND(LOOKUP(F2,{"a","a3","ftm,","m","m3"},{1,1, 1,1,1})=1,ISBLANK(J2)=FALSE),1,"")
--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"bob" wrote:

If F2 = "m" or "m3" or "a" or "a3" or "ftm," and J2 is not blank, I want to
return a value of 1.

Can anyone kindly help?

Thanks,
Bob

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Bob is offline
external usenet poster
 
Posts: 972
Default IF, OR, AND

Barb,

Excellent! Thank you very much.

Bob

"Barb Reinhardt" wrote:

One way.

=IF(AND(LOOKUP(F2,{"a","a3","ftm,","m","m3"},{1,1, 1,1,1})=1,ISBLANK(J2)=FALSE),1,"")
--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"bob" wrote:

If F2 = "m" or "m3" or "a" or "a3" or "ftm," and J2 is not blank, I want to
return a value of 1.

Can anyone kindly help?

Thanks,
Bob

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,059
Default IF, OR, AND

On Nov 2, 4:07*pm, bob wrote:
If F2 = "m" or "m3" or "a" or "a3" or "ftm,"
and J2 is not blank, I want to return a value of 1.


First, when you say "J2 is blank" (the opposite of "not blank"), do
you mean that it __appears__ blank, or do you mean that it really has
no formula? In other words, is the formula =if(true,"") blank or not
blank in your mind?

This is important because ISBLANK() is true only when J2 has no
formula or value, whereas J2="" is true whenever J2 appears blank.
(Well, technically, that should be TRIM(J2)="". But that is usually
overkill.)

Assuming you want the latter, one way to do what you ask without any
function overhead is:

=(J2<"") * ((F2="m")+(F2="m3")+(F2="a")+(F2="a3")+(F2="ftm"))

But your subject line suggests that you are interested in an IF/AND/OR
solution per se, perhaps because you are trying to understand that
combination. In that case:

=if(and(J2<"", or(F2="m",F2="m3",F2="a",F2="a3",F2="ftm")),1,0)

Or more simply:

=if(and(J2<"", or(F2={"m","m3","a","a3","ftm"})),1,0)

Or more simply:

=--and(J2<"", or(F2={"m","m3","a","a3","ftm"}))

Note: Replace J2<"" with ISBLANK(J2)=FALSE if you truly want to know
if the cell is empty (i.e. no value or formula).

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,344
Default IF, OR, AND

Hi,

Suppose you enter your list in the range A1:A5, then the formula is

=SUMPRODUCT((F2=$A$1:$A$5)*(J2<""))

This allows for easy modifications.

--
Thanks,
Shane Devenshire


"bob" wrote:

If F2 = "m" or "m3" or "a" or "a3" or "ftm," and J2 is not blank, I want to
return a value of 1.

Can anyone kindly help?

Thanks,
Bob

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



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