Solved

how to simplify this IF OR AND functions

Posted on 2016-10-06
9
32 Views
Last Modified: 2016-10-06
i have this long formula.

=IF(OR(AND(A2=1,B2=9),AND(A2=2,B2=12),AND(A2=3,B2=18),AND(A2=4,B2=15),AND(A2=5,B2=22),AND(A2=6,B2=95),AND(A2=12,B2=19),AND(A2=42,B2=52)),"","Ok")

is there any easy way or more simplistic way to achieve the same without these too many ORs and ANDs ? or make it work in a better way.
0
Comment
Question by:excelismagic
9 Comments
 
LVL 28

Assisted Solution

by:Subodh Tiwari (Neeraj)
Subodh Tiwari (Neeraj) earned 100 total points
ID: 41831503
One way....

=IF(ISNUMBER(MATCH(A2&B2,{"19","212","318","415","522","695","1219","4252"},0)),"","OK")

Open in new window

0
 
LVL 48

Accepted Solution

by:
Rgonzo1971 earned 400 total points
ID: 41831509
Hi,

pls try
=IF(MAX((A2={1,2,3,4,5,6,12,42})+(B2={9,12,18,15,22,95,19,52}))=2,"","Ok")

Open in new window

Regards
3
 
LVL 28

Assisted Solution

by:Subodh Tiwari (Neeraj)
Subodh Tiwari (Neeraj) earned 100 total points
ID: 41831515
Rgonzo's formula can be simplified as below...

=IF(MAX((A2={1,2,3,4,5,6,12,42})*(B2={9,12,18,15,22,95,19,52})),"","Ok")

Open in new window

0
 
LVL 28

Expert Comment

by:Subodh Tiwari (Neeraj)
ID: 41831519
@Rgonzo
Good catch. Thanks for the information. :)
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 3

Author Closing Comment

by:excelismagic
ID: 41831546
WOW Rgonzo

I am really impressed.
1
 
LVL 25

Expert Comment

by:ProfessorJimJam
ID: 41831550
+1  Rgonzo1971
0
 
LVL 28

Expert Comment

by:Subodh Tiwari (Neeraj)
ID: 41831560
Tweaked formula.....

=IF(ISNUMBER(MATCH(A2&" "&B2,{"1 9","2 12","3 18","4 15","5 22","6 95","12 19","42 52"},0)),"","OK")

Open in new window

0
 
LVL 3

Author Comment

by:excelismagic
ID: 41831602
thanks Neeraj
0
 
LVL 28

Expert Comment

by:Subodh Tiwari (Neeraj)
ID: 41831606
You're welcome!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

What is a Form List Box? (skip if you know this) The forms List Box is the alternative to the ActiveX list box. If you are using excel 2007, you first make sure you have a developer tab (click the Orb)->"Excel Options"->Popular->"Show Developer tab…
A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now