+ Reply to Thread
Results 1 to 6 of 6

If statement that looks at a range of cells

Hybrid View

  1. #1
    Registered User
    Join Date
    09-06-2012
    Location
    Arkansas
    MS-Off Ver
    Excel 2007
    Posts
    2

    If statement that looks at a range of cells

    I'm trying to populate a field based on a store # that I have made into a drop down box. Field H8 on the "Master BOL" tab is a drop down to pick the store #. After it is populated it copies the store # into AA1 (the only reason I did this was that my original IF stmt would not recgonize the # in the actual drop down field).

    I want to write an IF statement that will compare AA1 to DC Address List-Main'!A2-A43 and based on the row that matches populate C8 on the Master BOL with the corresponding store name. So =IF(AA1='DC Address List-Main'!A2,'DC Address List-Main'!B2,IF(AA1='DC Address List-Main'!A3,'DC Address List-Main'!B3, etc... If it is 6006 I want C8 to show WAL-MART DC 6006D-DSDC and so on. I know that I can only nest 7 IF statements so I'm stumped. I also want to be able to populate the address and city/state/zip fields the same way. Thanks in advance for any and all help!
    Attached Files Attached Files

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: If statement that looks at a range of cells

    Try:

    =VLOOKUP(H8,'DC Address List-Main'!$A:$I,2,FALSE)

    change the 2 to get next columns...
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Contributor CheshireCat's Avatar
    Join Date
    10-11-2011
    Location
    Victoria, Canada
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    258

    Re: If statement that looks at a range of cells

    Try this:

    =IF(H8="","",VLOOKUP(H8,'DC Address List-Main'!A:B,2,0))
    Docendo discimus.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,941

    Re: If statement that looks at a range of cells

    I converted all the store numbers to numbers rather than text that looks like numbers ... in the address list and the DV List.

    To be honest, you'd be better making the store number list on the address sheet a dynamic named range and using that in your DV.

    Anyway, the lookup would then be:

    =VLOOKUP(H8,'DC Address List-Main'!A:I,2,FALSE)

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Registered User
    Join Date
    09-06-2012
    Location
    Arkansas
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: If statement that looks at a range of cells

    All of you ROCK! It was making me crazy and I knew I was making harder than it actually was; it works like a charm now! This site is definitely on my list of favorites! A million thank you's!

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,941

    Re: If statement that looks at a range of cells

    You're welcome. Thanks for the rep.

+ 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