#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 190
Default IF

hi,

i have a cell in my worksheet that i am trying to do someting with ...
trying to add "AND" in the IF statement calculation

IF(sheet!B3 = "(ALL)", "specific", sheet!B3)

I tried the follwing but got an error:
IF(sheet!B3 = "(ALL)" AND sheet!W3 = "(ALL)", "specific", sheet!B3)

how can i add the "AND"?

thanks in advance,
geebee

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default IF

It's not very intuitive, but it goes like this:

If(And(Condition1,Condition2,Condition3),Then,Else ).

The "Or" function works the same way.

This is not how it would be done if you were using VBA code, but that's how
it's done for the Excel function.

It's important to have your parentheses in the right place too, especially
when using the "Or" function, and when mixing "And" and "Or" functions.

Hope this helps.

Keith



"geebee" wrote:

hi,

i have a cell in my worksheet that i am trying to do someting with ...
trying to add "AND" in the IF statement calculation

IF(sheet!B3 = "(ALL)", "specific", sheet!B3)

I tried the follwing but got an error:
IF(sheet!B3 = "(ALL)" AND sheet!W3 = "(ALL)", "specific", sheet!B3)

how can i add the "AND"?

thanks in advance,
geebee

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default IF

On Oct 3, 11:20 pm, geebee (noSPAMs) wrote:
hi,

i have a cell in my worksheet that i am trying to do someting with ...
trying to add "AND" in the IF statement calculation

IF(sheet!B3 = "(ALL)", "specific", sheet!B3)

I tried the follwing but got an error:
IF(sheet!B3 = "(ALL)" AND sheet!W3 = "(ALL)", "specific", sheet!B3)

how can i add the "AND"?

thanks in advance,
geebee


The and-functions takes both arguments and returns true or false, then
the if-functions check for true or false,
like this:
=IF(AND(B3="all";W3="all");"Specific";B3)

Per Erik

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default IF

applying Keithlo's explanation, you get.

IF(AND(Sheet!B3="(ALL"), Sheet!W3 = "(ALL"), "specific", Sheet!B3)

Shouldn't that be like Sheet1!B3 or Sheet2!B3 etc. ? Or does that mean
ActiveSheet in Excel speak?

"geebee" wrote:

hi,

i have a cell in my worksheet that i am trying to do someting with ...
trying to add "AND" in the IF statement calculation

IF(sheet!B3 = "(ALL)", "specific", sheet!B3)

I tried the follwing but got an error:
IF(sheet!B3 = "(ALL)" AND sheet!W3 = "(ALL)", "specific", sheet!B3)

how can i add the "AND"?

thanks in advance,
geebee

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:40 PM.

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"