+ Reply to Thread
Results 1 to 7 of 7

Embedded VLOOKUP function within IF function

  1. #1
    Registered User
    Join Date
    08-16-2006
    Posts
    3

    Question Embedded VLOOKUP function within IF function

    Please help!

    =IF(VLOOKUP(F252,'YB Engineer planning'!G:H,2,FALSE)="Olivetti Decommissioning",VLOOKUP(F252,'YB Engineer planning'!A:H,3,FALSE),"")

    I am trying to lookup two lots of data - one is a filter - "Olivetti Decommissioning" - then the site name is the second lookup provided the work is "Olivetti Decommissioning".

    The formula above works perfectly well for 95% of my data but for reasons best known to someone else there are 5 lookup entries that result in a blank cell (which is stated in the formula if there are no entries for the site name and "Olivetti Decommissioning"). These 5 entries ARE available on the Engineer planning worksheet. Most of the entries have more than one entry on the Engineer planning sheet but it is just the five that are not getting a result. I know that the formula is referencing properly because I get an #N/A if I change the names slightly.

    I have ensured that the lookup data is spelt the same. I cannot see what the issue is? Any ideas? Thanks in advance!



    Amanda

  2. #2
    bj
    Guest

    RE: Embedded VLOOKUP function within IF function

    to debug this, I would use the match() function to see what line is being
    found in both sections.
    =match(F252,'YB Engineer planning'!G:G)
    =match(F252,'YB Engineer planning'!A:A)
    check over the appropriate number of columns and see what you get.

    "beautyteknorth" wrote:

    >
    > Please help!
    >
    > =IF(VLOOKUP(F252,'YB Engineer planning'!G:H,2,FALSE)="Olivetti
    > Decommissioning",VLOOKUP(F252,'YB Engineer planning'!A:H,3,FALSE),"")
    >
    > I am trying to lookup two lots of data - one is a filter - "Olivetti
    > Decommissioning" - then the site name is the second lookup provided the
    > work is "Olivetti Decommissioning".
    >
    > The formula above works perfectly well for 95% of my data but for
    > reasons best known to someone else there are 5 lookup entries that
    > result in a blank cell (which is stated in the formula if there are no
    > entries for the site name and "Olivetti Decommissioning"). These 5
    > entries ARE available on the Engineer planning worksheet. Most of the
    > entries have more than one entry on the Engineer planning sheet but it
    > is just the five that are not getting a result. I know that the formula
    > is referencing properly because I get an #N/A if I change the names
    > slightly.
    >
    > I have ensured that the lookup data is spelt the same. I cannot see
    > what the issue is? Any ideas? Thanks in advance!
    >
    >
    >
    > Amanda
    >
    >
    > --
    > beautyteknorth
    > ------------------------------------------------------------------------
    > beautyteknorth's Profile: http://www.excelforum.com/member.php...o&userid=37585
    > View this thread: http://www.excelforum.com/showthread...hreadid=572113
    >
    >


  3. #3
    Registered User
    Join Date
    08-16-2006
    Posts
    3
    Hi bj,

    I've tried this - there are multiple occurances of the same value in the list and the list is unsorted so if I omit the match type the function returns some random value and if I include the match type it accurately returns the first instance of the value in the list.

    I don't get why only 5 values are affected!!

    Thanks for your help.

    Amanda

  4. #4
    Forum Expert
    Join Date
    09-09-2005
    Location
    England
    MS-Off Ver
    2007
    Posts
    1,500
    try what bj said but use
    =match(F252,'YB Engineer planning'!G:G,0)
    =match(F252,'YB Engineer planning'!A:A,0)

    to ensure exact matches.

    Check for extra spaces after the text strings, they could be causing you problems

    Regards

    Dav

  5. #5
    bj
    Guest

    Re: Embedded VLOOKUP function within IF function

    thanks Dav, I knew better (or should have)

    "Dav" wrote:

    >
    > try what bj said but use
    > =match(F252,'YB Engineer planning'!G:G,0)
    > =match(F252,'YB Engineer planning'!A:A,0)
    >
    > to ensure exact matches.
    >
    > Check for extra spaces after the text strings, they could be causing
    > you problems
    >
    > Regards
    >
    > Dav
    >
    >
    > --
    > Dav
    > ------------------------------------------------------------------------
    > Dav's Profile: http://www.excelforum.com/member.php...o&userid=27107
    > View this thread: http://www.excelforum.com/showthread...hreadid=572113
    >
    >


  6. #6
    Registered User
    Join Date
    08-16-2006
    Posts
    3
    Hi guys,

    Yep, tried all of this. Not solving the problems though. The text strings are identical and the match function returns (correctly) only the first entry when using the match type 0.

    I'm stumped!


  7. #7
    Forum Expert
    Join Date
    09-09-2005
    Location
    England
    MS-Off Ver
    2007
    Posts
    1,500
    If you are using a match type 0, which is the same as your vlookup in essence it will always return the first match.

    You maybe have to restate your problem giving an example and showing what you want exactly as the solution. In your example

    =IF(VLOOKUP(F252,'YB Engineer planning'!G:H,2,FALSE)="Olivetti
    Decommissioning",VLOOKUP(F252,'YB Engineer planning'!A:H,3,FALSE),"")

    If the first match of f252 in columnG has olivetti Decommissioning next to it you are then saying rematch this value in f252 in columnA and return the value in column c next to it.

    If column A is different to column G you will not be returning the same row

    What exactly do you want to achieve?

    Regards

    Dav

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1