ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   IF (https://www.excelbanter.com/excel-programming/398632-if.html)

geebee

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


Keithlo

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


Per Erik Midtrød[_2_]

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


JLGWhiz

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



All times are GMT +1. The time now is 12:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com