We’d like to remind Forumites to please avoid political debate on the Forum.

This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.

📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
The Forum now has a brand new text editor, adding a bunch of handy features to use when creating posts. Read more in our how-to guide

Where Have I Went Wrong? (Excel)

Cotta
Cotta Posts: 3,667 Forumite
edited 4 August 2016 at 3:10PM in Techie Stuff
Hi All,


I'm trying to use a double vertical lookup and a "Match" statement, however I am returned an error. How can this code be corrected? It currently advises that "too many arguments have been entered".


=VLOOKUP(VLOOKUP(A32,'EXT60'!A3:BG148,MATCH(E29,'EXT60'!1:1,0),Location!$B$3:$C$25,2,FALSE))
«1

Comments

  • John_Gray
    John_Gray Posts: 5,847 Forumite
    Part of the Furniture 1,000 Posts Name Dropper Photogenic
    Where have you gone wrong?

    Very difficult to say, since you don't say what error Excel gave you.
    And there are no clues as to what data and worksheets you have.

    Standard practice would be to split up the complex statement into shorter ones, in several cells, and see what error(s) you get then.
  • Cotta
    Cotta Posts: 3,667 Forumite
    Sorry it advises that too many arguments have been entered.
  • bod1467
    bod1467 Posts: 15,214 Forumite
    Each VLOOKUP needs

    Search term
    Source array
    Cell to return
    True/False (for a close or exact match)

    The outer VLOOKUP seems to be missing the last parameter.
  • Cotta
    Cotta Posts: 3,667 Forumite
    bod1467 wrote: »
    Each VLOOKUP needs

    Search term
    Source array
    Cell to return
    True/False (for a close or exact match)

    The outer VLOOKUP seems to be missing the last parameter.

    There is a "false" at the end of the statement.


    =VLOOKUP(VLOOKUP(A32,'EXT60'!A3:BG148,MATCH(E29,'E XT60'!1:1,0),Location!$B$3:$C$25,2,FALSE))
  • bod1467
    bod1467 Posts: 15,214 Forumite
    edited 4 August 2016 at 4:03PM
    Actually it's not just the FALSE; it's the position of the parentheses. To recap:

    VLOOKUP(Search,Array,Column,FALSE)

    In your case you need:

    VLOOKUP(VLOOKUP(Search, Array, Column, FALSE), Array, Column, FALSE)

    The nested VLOOKUP is the Search term for the outer VLOOKUP.

    In your OP, the MATCH is the Column term for the nested VLOOKUP, and there is no FALSE term for the outer VLOOKUP. So ...

    VLOOKUP(VLOOKUP(Search, Array, MATCH(), FALSE), Array, Column, FALSE)
  • bod1467
    bod1467 Posts: 15,214 Forumite
    And if that wasn't what you intended then you'll need to reassess your requirements.
  • Cotta
    Cotta Posts: 3,667 Forumite
    edited 5 August 2016 at 9:10AM
    Using your logic Bod I think it's almost cracked. I'm getting a "#REF!" error now and it seems to involve the value before "location". I wonder if the problem is that this calculation is taking place in cell E30 and the first part of the formula is returning a certain value, then I need the formula to use this value to carry out the second part. Is this the problem and how do I get around it?




    =VLOOKUP(VLOOKUP(A31,'EXT60'!A:JI,MATCH(Template!$E$29,'EXT60'!$1:$1,0)),Location!B4:C26,2,FALSE)
  • Heedtheadvice
    Heedtheadvice Posts: 2,949 Forumite
    Part of the Furniture 1,000 Posts Name Dropper
    Oh do use named ranges, it makes formulae so much easier to read, especially to others!!
    Plus the idea (already mentioned in another post) of breaking it down into simple steps will assist in putting the whole together.

    That can best be done by having each simple formula step on a cell referenced by the next formula in the chain. It then becomes more obvious both if it works correctly (you can check the answer returned in each cell step) and, if it causes an error , see which formula causes that error.

    Far too easy to make it over complicated and not see the wood for the trees and in many cases no need to combine together in a complex looking formula!
  • rmg1
    rmg1 Posts: 3,159 Forumite
    Part of the Furniture 1,000 Posts Name Dropper
    You could also use the "Evaluate Formula" option in Excel top find which section gives you an error. There's nothing wrong with your formula from a syntax point of view (the one in post 8 anyway)
    :wall: Flagellation, necrophilia and bestiality - Am I flogging a dead horse? :wall:

    Any posts are my opinion and only that. Please read at your own risk.
  • bod1467
    bod1467 Posts: 15,214 Forumite
    Cotta wrote: »
    =VLOOKUP(VLOOKUP(A31,'EXT60'!A:JI,MATCH(Template!$E$29,'EXT60'!$1:$1,0)),Location!B4:C26,2,FALSE)

    Does Location not need ' ' around it?

    'Location'!B4:C26
This discussion has been closed.
Meet your Ambassadors

🚀 Getting Started

Hi new member!

Our Getting Started Guide will help you get the most out of the Forum

Categories

  • All Categories
  • 353.5K Banking & Borrowing
  • 254.2K Reduce Debt & Boost Income
  • 455.1K Spending & Discounts
  • 246.6K Work, Benefits & Business
  • 603K Mortgages, Homes & Bills
  • 178.1K Life & Family
  • 260.6K Travel & Transport
  • 1.5M Hobbies & Leisure
  • 16K Discuss & Feedback
  • 37.7K Read-Only Boards

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.