Solved

IF OR formula Excel - multiple conditions

Posted on 2016-10-12
9
81 Views
Last Modified: 2016-10-13
I need help writing an if statement that is dependent on the conditions from two cell refs - see below.

Use similar logic displayed in formula below;

=MIN(IF(B1<=0),0,IF(AND(A1>=0,B1<5),1,IF(AND(B1>=5,A1<=10),2,IF(A1>=10,3,0)))) ,IF(A1>1250000,2,3))

if or


IF YE Extrapolated <15,000 then return 0







If YE extrapolated >=15,000<50,000 then apply the following IF statements;

IF Pre YE <=0 then return 0

OR

IF Pre YE >0<5 then return 1

OR

IF Pre YE >=5<10 then return 2

OR

IF Pre YE >=10 then return 3






IF YE extrapolated is >=50,000 <1,250,000 then apply the following IF statements;

IF Pre YE <=0 then return 0

OR

IF Pre YE >0<5 then return 1

OR

IF Pre YE >=5<10 then return 2

OR

IF Pre YE >=10 then return 4







IF YE extrapolated is >=1,250,000 then apply the following IF statements;
IF Pre YE <=0 then return 0

OR

IF Pre YE >0<5 then return 1

OR

IF Pre YE >=5 then return 3



See expected result highlighted in yellow

Mike
0
Comment
Question by:mikes6058
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
9 Comments
 
LVL 26

Assisted Solution

by:Shaun Kline
Shaun Kline earned 125 total points
ID: 41840660
Something like this?
=IF(OR(A2<15000, C2<=0), 0, IF(C2< 0.05, 1, IF(AND(A2<1250000, C2<0.1), 2, IF(AND(A2>=50000,A2<125000), 4, 3))))

Open in new window


Where A2 is the first row of data in the YE Extrapolated column, and C2 is the first row of data in the Pre YE column.
0
 
LVL 48

Expert Comment

by:Martin Liss
ID: 41840884
I don't know if you want to use a UDF like me last one but...
Function YE_YE(r As Range) As Integer

    Select Case True
        Case r(1) < 15000
            YE_YE = 0
        Case r(1) >= 15000 & r(1) < 50000
            Select Case True
                Case r(2) <= 0
                    YE_YE = 0
                Case r(2) > 0 And r(2) < 5
                    YE_YE = 1
                Case r(2) >= 5 And r(2) < 10
                    YE_YE = 2
                Case r(2) >= 10
                    YE_YE = 3
            End Select
        Case r(1) >= 50000 & r(1) < 125000
            Select Case True
                Case r(2) <= 0
                    YE_YE = 0
                Case r(2) > 0 And r(2) < 5
                    YE_YE = 1
                Case r(2) >= 5 And r(2) < 10
                    YE_YE = 2
                Case r(2) >= 10
                    YE_YE = 4
            End Select
        Case r(1) >= 1250000
            Select Case True
                Case r(2) <= 0
                    YE_YE = 0
                Case r(2) > 0 And r(2) < 5
                    YE_YE = 1
                Case r(2) >= 5
                    YE_YE = 3
            End Select
    End Select

End Function

Open in new window

0
 

Author Comment

by:mikes6058
ID: 41840935
Hi Martin,

I tried using the UDF but the results were not the same as the expected results.

Instead I got,

0
3
3
3
3
3

Could you show me the native excel formula used?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 48

Assisted Solution

by:Martin Liss
Martin Liss earned 125 total points
ID: 41840987
Sorry, I didn't notice that you had changed the data as compared to your other question. I can't help you with a native formula but this will give you the results you show. Note that the usage is now =YE_YE(A1,C1)   Note the comma instead of the colon.

Function YE_YE(rA As Range, rC) As Integer

    Select Case True
        Case rA < 15000
            YE_YE = 0
        Case rA >= 15000 And rA < 50000
            Select Case True
                Case rC <= 0
                    YE_YE = 0
                Case rC > 0 And rC < 5
                    YE_YE = 1
                Case rC >= 5 And rC < 10
                    YE_YE = 2
                Case rC >= 10
                    YE_YE = 3
            End Select
        Case rA >= 50000 And rA < 125000
            Select Case True
                Case rC <= 0
                    YE_YE = 0
                Case rC > 0 And rC < 5
                    YE_YE = 1
                Case rC >= 5 And rC < 10
                    YE_YE = 2
                Case rC >= 10
                    YE_YE = 4
            End Select
        Case rA >= 1250000
            Select Case True
                Case rC <= 0
                    YE_YE = 0
                Case rC > 0 And rC < 5
                    YE_YE = 1
                Case rC >= 5
                    YE_YE = 3
            End Select
    End Select

End Function

Open in new window

0
 
LVL 51

Expert Comment

by:Rgonzo1971
ID: 41841391
Hi,

pls try
=IF(A1<15000,0,MIN(IF(B1<=0,0,IF(AND(A1>0,B1<5),1,IF(AND(B1>=5,A1<=10),2,IF(A1>=10,3,0)))),IF(A1>1250000,2,3)))

Open in new window

Regards
0
 

Author Comment

by:mikes6058
ID: 41841670
The results I am getting are different from what I would expect.

See table below. Also see attached as Excel file.

if sif-statement-test.xlsx
0
 
LVL 51

Accepted Solution

by:
Rgonzo1971 earned 250 total points
ID: 41841710
then try
=IF(A1<15000,0,IF(AND(A1>=15000,A1<50000),IF(B1<=0,0,IF(AND(B1>0,B1<5),1,IF(AND(B1>=5,B1<=10),2,IF(A1>=10,3,0)))),IF(AND(A1>=50000,A1<1250000),IF(B1<=0,0,IF(AND(B1>0,B1<5),1,IF(AND(B1>=5,B1<=10),2,IF(A1>=10,4,0)))),IF(B1<=0,0,IF(AND(B1>0,B1<5),1,IF(B1>=5,3))))))

Open in new window

0
 
LVL 26

Expert Comment

by:Shaun Kline
ID: 41841711
Did you try my formula up top?
0
 

Author Comment

by:mikes6058
ID: 41841801
I did Shaun, but I was getting a syntax error and couldn't figure out what it was. Thanks for you contribution though.

That worked brilliantly Rgonzo. Thanks a lot!

Mike
0

Featured Post

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question