+ Reply to Thread
Results 1 to 4 of 4

Look up cell value in range of cells and copy adjacent cell.

  1. #1
    Registered User
    Join Date
    02-02-2016
    Location
    Nottingham, England
    MS-Off Ver
    2010
    Posts
    2

    Look up cell value in range of cells and copy adjacent cell.

    Greetings everyone! I've run into something of a wall, so I thought this might be the best place to ask for help

    Right now I have a spreadsheet in a File 1 with a number of column. I want to look up the value (they're text) of two adjacent cells in the File 1 (i.e. B2:C2) to see if they also occur together in a range of cells A2:B33 in a File 2. If they do, I want to copy the corresponding value (same row) found in a different column (Column F) of File 2 back into the formula cell of File 1.

    I've tried two different approaches. In one, I've tried to check if the string in B2 and the string in C2 of File 1 occur together in the File 2 range by nesting IF statements:

    =IFERROR(VLOOKUP(B2,[File2.xlsx]Sheet1!$A$2:$A$33,IFERROR(VLOOKUP(C2,[File2.xlsx]Sheet1!$B$2:$B$33,5,FALSE),"")),"")

    I've also tried by looking them up together as a range:

    =IFERROR(VLOOKUP(B2:C2,[File2.xlsx]Sheet1!$A$2:$B$33,5,FALSE),"")),"")

    Neither formula returns an error. However, they both return empty cells, even though I know the values I'm looking up are in that range. I can't quite figure out where I'm going wrong. Any ideas?

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Look up cell value in range of cells and copy adjacent cell.

    See if you can adapt this to suit your needs...

    Data Range
    A
    B
    C
    D
    E
    F
    G
    1
    This
    That
    Data1
    Yes
    No
    Data4
    2
    Yin
    Yang
    Data2
    3
    North
    South
    Data3
    4
    Yes
    No
    Data4
    5
    Vice
    Versa
    Data5
    6
    ------
    ------
    ------
    ------
    ------
    ------
    ------


    We want to lookup the combination of Yes and No.

    This array formula** entered in G1:

    =IFERROR(INDEX(C1:C5,MATCH(1,(A1:A5=E1)*(B1:B5=F1),0)),"")

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    02-02-2016
    Location
    Nottingham, England
    MS-Off Ver
    2010
    Posts
    2

    Re: Look up cell value in range of cells and copy adjacent cell.

    Amazing, that worked! Thank you!

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Look up cell value in range of cells and copy adjacent cell.

    You're welcome. Thanks for the feedback!

+ 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. [SOLVED] Copy Cell Adjacent to Blank Cell in Range.
    By NewExcelUser in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-20-2015, 07:45 PM
  2. Copy non-adjacent cells based on value in another cell
    By pab61 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-13-2015, 12:28 PM
  3. [SOLVED] copy cell values in one cell based on value of adjacent cells
    By KK1234 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-20-2014, 08:48 AM
  4. Replies: 1
    Last Post: 01-03-2014, 03:01 AM
  5. Copy the value in a cell, X times to adjacent cells
    By mselbie in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-16-2013, 02:00 PM
  6. [SOLVED] What is the best way to examine cell and copy adjacent cells to another worksheet?
    By LMersch in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 07-19-2012, 06:08 PM
  7. Select and copy cells based on adjacent cell
    By Zaeguzah in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-30-2010, 02:42 AM

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