Is this the most efficient formula

MARK858

MrExcel MVP
Joined
Nov 12, 2010
Messages
16,813
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
Hi all,
I have the Vlookup formula below. Now it is working correctly but the question I have is this the most efficient way of doing this?

It is obviously performing 3 Vlookups to get the desired result (i.e. turning all errors and value 0 to "Not Set") and this gives me concerns over whether it the most efficient way of achieving it.

Unfortunately it does need to work with 2003.

Any pointers anyone can give would be much appreciated.
Formula
=IF(ISERROR(VLOOKUP(A2,Sheet3!A:M,9,0)),"Not Set",IF(VLOOKUP(A2,Sheet3!A:M,9,0)=0,"Not Set",VLOOKUP(A2,Sheet3!A:M,9,0)))
 
Sorry for the confusion Aladin, I put the formulas into Y & Z purely to demonstrate the results I was getting side by side. It was not where they go in the actual spreadsheet. This result is referring to posting #4.

On the formulas in posting #8 I am getting a too many arguments error for the first formula and a "formula contains an error" on the second formula.
I have entered the first as

=IF(LOOKUP(A2,Sheet3!A:A)=A2,T(LOOKUP(A2,Sheet3!A:A,Sheet3!I:I),"Not Set")

and the second as

=IF(LOOKUP(A2,Sheet3!A:A)=A2,IF(LOOKUP(A2,Sheet3!A:A,Sheet3!I:I)="","Not Set",LOOKUP(A2,Sheet3!A:A,Sheet3!I:I);"Not Set")
 
Last edited:
Upvote 0

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Sorry for the confusion Aladin, I put the formulas into Y & Z purely to demonstrate the results I was getting side by side. It was not where they go in the actual spreadsheet. This result is referring to posting #4.

On the formulas in posting #8 I am getting a too many arguments error for the first formula and a "formula contains an error" on the second formula.
I have entered the first as

=IF(LOOKUP(A2,Sheet3!A:A)=A2,T(LOOKUP(A2,Sheet3!A:A,Sheet3!I:I),"Not Set")

and the second as

=IF(LOOKUP(A2,Sheet3!A:A)=A2,IF(LOOKUP(A2,Sheet3!A:A,Sheet3!I:I)="","Not Set",LOOKUP(A2,Sheet3!A:A,Sheet3!I:I);"Not Set")

Darn it... Apologies...

1. T() is missing its closing paren. Corrected:

Code:
=IF(LOOKUP(A2,Sheet3!A:A)=A2,
    T(LOOKUP(A2,Sheet3!A:A,Sheet3!I:I)),
    "Not Set")

2. The 2nd IF() is missing its closing paren. Corrected:

Code:
=IF(LOOKUP(A2,Sheet3!A:A)=A2,
   IF(LOOKUP(A2,Sheet3!A:A,Sheet3!I:I)="",
      "Not Set",
      LOOKUP(A2,Sheet3!A:A,Sheet3!I:I));
   "Not Set")
 
Upvote 0
Hi Aladin I had to change in the second formula

LOOKUP(A2,Sheet3!A:A,Sheet3!I:I));

to

LOOKUP(A2,Sheet3!A:A,Sheet3!I:I)),

and then it gave the results I am looking for.

Just to clarify that my understanding is correct you believe this will be more efficient than the dynamic named range solution in Mike's previous posting?

Obviously I realise that your code must have Column A sorted and Mikes is a solution if it isn't.

P.S. could you explain what the "T" is in the first formula
 
Last edited:
Upvote 0
Hi Aladin I had to change in the second formula

LOOKUP(A2,Sheet3!A:A,Sheet3!I:I));

to

LOOKUP(A2,Sheet3!A:A,Sheet3!I:I)),

and then it gave the results I am looking for.

Just to clarify that my understanding is correct you believe this will be more efficient than the dynamic named range solution in Mike's previous posting?

Yes. Even without resorting to a dynamic named range.

Obviously I realise that your code must have Column A sorted and Mikes is a solution if it isn't.

Yes, the set up requires sorting on column A in ascending order.

P.S. could you explain what the "T" is in the first formula

T(A2)

returns a blank when A2 is empty/blank or houses a numeric value or a logical value; If A2 houses a text value of non-zero length, it returns that text value as is.
 
Upvote 0
Thank you Aladin for your help and hard work on this thread. I also thank you for helping me learn a bit more (not just for your explanation of T(A2) but for teaching me a bit more with the formula itself).

I also thank Mike and Cindy again for their earlier postings as they too have improved my knowledge , your efforts are appreciated.
 
Upvote 0
Sorting the data and using Aladdin's method (using IF to check if the value you get when you lookup the lookup column itself equals the original lookup Value) will be orders of magnitude faster than any other solution.
 
Upvote 0
Thanks for your input Charles. It definitely has been when testing the various options today
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,297
Members
452,903
Latest member
Knuddeluff

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