combining two formulas into one

Lenna

Active Member
Joined
Jun 25, 2014
Messages
269
Please help to combine two formulas into one:

Formula 1
IF L2 is blank and J2 doesn’t contain (AT1R/LCTI/LPRI/LPRI_RPT/LPRII/LPRII_RPT), if true return “NoOrderNumberFound”, otherwise “Not Reported”.

Formula 2
IF L2 is not blank, lookup N2 in row P(has sorted unique values) and return either “WrongTest” if not found, or “CorrectTest” if it was found.

=IF(ISERROR(VLOOKUP(N2,P:P,1,FALSE)),"WrongTest","CorrectTest")

Thank you,

Lenna
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
You could use the choose function:

Code:
=CHOOSE(IF(L2="",1,2),"Formula if L2 = Blank","Formula if L2 is not blank")
 
Upvote 0
I'm working on Formula 1. How do I get it to return either “NoOrderNumberFound” if it doesn't contain and “Not Reported” if it does?
This formula returns only True/False.

=OR(ISNUMBER(SEARCH("AT1R",$L5)),ISNUMBER(SEARCH("LCTI",$L5)), ISNUMBER(SEARCH("LPRI",$L5)), ISNUMBER(SEARCH("LPRI_RPT",$L5)), ISNUMBER(SEARCH("LPRII",$L5)), ISNUMBER(SEARCH("LPRII_RPT",$L5)))=FALSE

Thanks
 
Upvote 0
What is 1,2 ?

It's the choose function, you have an index number, the 1 means it chooses the first formula I put in there, the 2 means it chooses the second.
If L2="", the result is one and it picks formula 1, otherwise the if evaluates to 2 and it chooses the the second formula.

I could say if something, have it evaluate to 1 if true and then have another if statement in the false and if that if statement evalutes to true it would equal 2 and then another if statement if false and have the next if statement evaluate to 3 etc. You seem to want to do a lot, so I thought choose would be a good option.

Read Excel help for the choose function for a better understanding.
 
Upvote 0
I'm working on Formula 1. How do I get it to return either “NoOrderNumberFound” if it doesn't contain and “Not Reported” if it does?
This formula returns only True/False.

=OR(ISNUMBER(SEARCH("AT1R",$L5)),ISNUMBER(SEARCH("LCTI",$L5)), ISNUMBER(SEARCH("LPRI",$L5)), ISNUMBER(SEARCH("LPRI_RPT",$L5)), ISNUMBER(SEARCH("LPRII",$L5)), ISNUMBER(SEARCH("LPRII_RPT",$L5)))=FALSE

Thanks

OR only returns true of false. Put the OR statement in an If statement and then put what you want if it evaluates to true and whatever else you want if it evalutes to false.
 
Upvote 0
This formula seems to work with both AND/OR. What is the difference?

=CHOOSE(IF($L5="",1,2), IF(AND($J5<>"AT1R",$J5<>"LCTI",$J5<>"LPRI",$J5<>"LPRI_RPT",$J5<>"LPRII",$J5<>"LPRII_RPT"),"NoOrderNumberFound","Test Not Reported"),IF(ISERROR(VLOOKUP($J5,O:O,1,FALSE)),"WrongTestOrdered","CorrectTest"))
 
Upvote 0

Forum statistics

Threads
1,214,797
Messages
6,121,629
Members
449,041
Latest member
Postman24

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