+ Reply to Thread
Results 1 to 5 of 5

If-Contain Vlookup Equation

Hybrid View

  1. #1
    Registered User
    Join Date
    11-05-2014
    Location
    SF
    MS-Off Ver
    Excel 2010
    Posts
    39

    If-Contain Vlookup Equation

    Hello, I could really use some help with creating an equation for what I am trying to do below:

    1. Vlookup from A1 if it's not blank (i can do this)
    2. If A1 is blank, then check to see what B1 says.
    3. If B1 contains the string ENH, then run a vlookup in Tab1; If it contains CGE, then run a vlookup in Tab2; If ACZ, Tab3; If GPA, Tab4.

    How can I write such an equation.

    Thanks so much, in advance!
    -Excelnoob927
    Last edited by excelnoob927; 12-26-2014 at 06:51 PM. Reason: solved

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: If-Contain Vlookup Equation

    You could achieve this with nested IFs and VLOOKUPs but it would be long and painful.
    I'm sure there's a better solution but without seeing a sample workbook it's hard to say what it would be.

    BSB

  3. #3
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,481

    Re: If-Contain Vlookup Equation

    Quote Originally Posted by excelnoob927 View Post
    Hello, I could really use some help with creating an equation for what I am trying to do below:

    1. Vlookup from A1 if it's not blank (i can do this)
    2. If A1 is blank, then check to see what B1 says.
    3. If B1 contains the string ENH, then run a vlookup in Tab1; If it contains CGE, then run a vlookup in Tab2; If ACZ, Tab3; If GPA, Tab4.

    How can I write such an equation.

    Thanks so much, in advance!
    -Excelnoob927
    Basically, try
    =IF(A1<>"",VLOOKUP from A1,IF(ISNUMBER(SEARCH("ENH",B1)),VLOOKUP in TAB1,IF(ISNUMBER(SEARCH("CGE",B1)),VLOOKUP in TAB2,IF(ISNUMBER(SEARCH("ACZ",B1)),VLOOKUP in TAB3,IF(ISNUMBER(SEARCH("GPA",B1)),VLOOKUP in TAB4,"")))))
    Quang PT

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: If-Contain Vlookup Equation

    or maybe
    =IF(A1<>"","vlookup from a1",CHOOSE(MATCH(TRUE,ISNUMBER(SEARCH({"ENH";"CGE";"ACZ";"GPA"},B1)),0),"vlook up in tab1","vlook up in tab2","vlook up in tab3","vlook up in tab4"))
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  5. #5
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: If-Contain Vlookup Equation

    If you find the formula syntax of the responses of bebo021999 and martinwilson difficult to follow, I created an example that uses both of their instructions using actual tab and cell references to make the examples less abstract....I hope.

    In addition, I don't know if the formula for A1 is dependent upon the value in B1 and visa versa or are they independent of each other with the exception of the situation where A1 is blank?

    I have attempted to show on the enclosed file the situation where A1 and B1 are interdependent and where they are not.

    I used the basic formula outlines previously given by bebo021999 and martinwilson

    I hope that this is a clarification and not an added confusion.
    Last edited by newdoverman; 12-26-2014 at 05:59 PM.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. If, search, and vlookup equation
    By zeez36 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-19-2013, 02:08 PM
  2. [SOLVED] Help with sumif or sumproductand/or vlookup in equation
    By deacs in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-12-2012, 10:35 PM
  3. How to use VLOOKUP for a ranges of values in an equation
    By DocScience in forum Excel General
    Replies: 2
    Last Post: 06-20-2012, 05:58 PM
  4. [SOLVED] VLookUp and IF Logic Equation In Same Cell
    By garrett.grillo in forum Excel General
    Replies: 7
    Last Post: 05-30-2012, 11:38 PM
  5. Long equation, problem w/ VLOOKUP (repeated, one instance gives error..)
    By cptwhite in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 02-14-2008, 12:37 PM

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