Complex IF function

dgavin

Active Member
Joined
Feb 16, 2005
Messages
302
How do I write the following in a formula.

If within range Log!D18:E50 there is "A" and U1 >3 and S1<=Controls!$B$1 then "BACK" if not then ""

Thanks
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
I still get "BACK" even if there is no "A" in range Log!D18:E50

If there is no "A" found then i need it to return nothing?

P.S there are also "B" in that range as well.
 
Upvote 0
No that shouldn't happen, using AND means that all 3 conditions must be TRUE for "BACK" to be returned. A single "A" (or "a") on its own anywhere in the range Log!D18:E50 will satisfy the first condition.

Did you mean to have a two column range - should it be case-sensitive?
 
Upvote 0
Hi I got the range wrong, rather than at looking at both columns I should have been looking at adjacent cells.

=IF(AND(COUNTIF(Log!D18:E18,"A")>0,U1 >3,S1<=Controls!$B$1),"BACK","")

How do I expand on this by adding..

if any cell whole range Log!D18:E50 = "B" and its corresponding cells in C are less than 5 and if U1 >3,S1<=Controls!$B$1 then "BACK"

Thanks
 
Upvote 0
This looks as though it's another IF in which case you need an or statement. Something along the lines of:


IF(OR(AND(COUNTIF(D18:E18,"B")>1,C18<5,U1>3,S1<=Controls!$B$1) ,AND(COUNTIF(Log!D18:E50,"A")>0,U1 >3,S1<=Controls!$B$1)),"BACK","")
 
Upvote 0
Ok I have changed it slightly but still dosen't work.

=IF(OR(AND(COUNTIF(D18:E18,"B")>1,Dutch!B18<=5,$U$1>3,$S$1<=Controls!$B$1),AND(COUNTIF(Dutch!D18:E18,"A")>0,$U$1>3,$S$1<=Controls!$B$1)),"BACK","")

I get "BACK" when "A" is in the range, but when "B" is in the range and Dutch!B18<=5 I don't get "BACK"
 
Upvote 0
=IF(OR(AND(COUNTIF(D18:E18,"B")>0,Dutch!B18<=5,$U$1>3,$S$1<=Controls!$B$1),AND(COUNTIF(Dutch!D18:E18,"A")>0,$U$1>3,$S$1<=Controls!$B$1)),"BACK","")


Shouuld be zero not one. Whoops!
 
Upvote 0

Forum statistics

Threads
1,224,532
Messages
6,179,388
Members
452,908
Latest member
MTDelphis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top