SHOPPING CART0 item(s)$0.00 AUD + GST

Which LOOKUP?

08 June, 2011

LOOKUP functions, especially VLOOKUPs are very commonly used in financial modelling – sometimes a little too commonly used!  Knowing when and how to use them – and use them well is a critical skill for any financial modeller.   Let's explore some of the problems with LOOKUP functions and how to make their more robust. 

 VlookupVlookupIf you have created a VLOOKUP in a model such as the one here, this should work well….                                      

Until someone enters or deletes a column in your source data! 

With a formula such as  =VLOOKUP(A19,A2:B15,2,0), it specifically asks for the second column, so it will not work if someone inserts a column within the range.  This is because your required column becomes the third column, but the VLOOKUP is asking for the second.

VLOOKUPs and HLOOKUPs are not particularly robust formulas – you can see how easy they are to break!  For this reason, try some of the alternatives below to make your LOOKUP more robust, use another formula, or else protect your model so that users cannot insert or delete rows or columns.

The best way around this is to make the “2” in your VLOOKUP a formula instead of a hard-coded number.  A way to do this is to nest the VLOOKUP with a MATCH, COLUMN or ROW function.

What difference does a V make?

HLOOKUPs work in exactly the same way, except that they are orientated horizontally instead of vertically, and are subject to the same problems.

The LOOKUP function is much simpler than either the VLOOKUP or the HLOOKUP, and it has the added advantage of being able to have the results column or row either to the left or the right of the criteria column or row – a huge advantage.  However, LOOOKUPs will only return a close match and so the data MUST be sorted in alphabetical order or it won’t work.  This does limit it usage significantly, and it is for this reason that it is far less popular than the VLOOKUP or HLOOKUP formulas. 

So, which LOOKUP function should I use?

Here's a quick overview of the different LOOKUP functions and where and when to use them!TableTable

 

 

 

 

 

 

 

 

 

 

 

 

 

 

What are the alternatives to a VLOOKUP?

If a VLOOKUP simply isn’t doing it for you, you might consider a combination of an INDEX and MATCH functions which take a little longer to build, but do not have the limitations of LOOKUP formulas. 

Comments

Formula which can be better than vlookup in many circumstances is sumif moreover the vlookup formula is heavy on the file size where sumif is not.

Submitted by Tauseef Abbas (not verified) on Fri, 10/06/2011 - 05:13.

Thanks Tauseef, yes great point - SUMIF is a fantastic alternative to VLOOKUP!  I read something the other day which says that VLOOKUPS are not slower, see http://chandoo.org/wp/2011/06/07/excel-formula-myths/  but I do find that SUMIF is often a good solution because it uses two independent ranges the SUMIF (or SUMIFS) copies across and down very easily without worrying about the hard-coded number of columns.

Submitted by danielle on Fri, 10/06/2011 - 06:47.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd><img><h1><h2><h3><p><br><iframe>
  • Lines and paragraphs break automatically.
  • Images can be added to this post.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.