+ Reply to Thread
Results 1 to 15 of 15

Excel 2007 : Matching a value in a different workbook from 2 rows & copy a value from that column

  1. #1
    Registered User
    Join Date
    03-11-2011
    Location
    Belgium
    MS-Off Ver
    Excel 2007
    Posts
    14

    Question Matching a value in a different workbook from 2 rows & copy a value from that column

    Hi everyone

    here is my situation:
    I have multiple workbooks that is filled in by people. This workbook has headers but these headers are in different columns depending on the person filling this in and the customer for who it is. These headers can be on row 2 or 3.

    I need to extract data from this workbook, so I make a new generic workbook where I place my headers in.
    Next I look up if my header corresponds with the header from the workbook containing the data:
    =IF(C$2='[Follow-Up.xls]IN'!C$2;'[Follow-Up.xls]IN'!C$1;

    => Read this as: If my cell C2 matches the cell C2 from the file Follow-Up.xls worksheet IN, then copy the cell C1 from the file Follow-Up.xls worksheet IN to this cell.

    If C2 doesn't match cell C2 from the file Follow-Up.xls worksheet IN

    INDEX('[Follow-Up.xls]IN'!$A$1:$FZ$6000;1;MATCH(C$2;'[Follow-Up.xls]IN'!$A$2:$FZ$3;0)))

    Look for a match of cell C2 in the file Follow-Up.xls worksheet IN range A2:FZ3
    If you have found this, display the first entry (hence the 1) from this row in the range A1:FZ600

    The problem I have with this formula is that the following doesn't work:

    MATCH(C$2;'[Follow-Up.xls]IN'!$A$2:$FZ$3;0)))

    It resolves C2 but NOT '[Follow-Up.xls]IN'!$A$2:$FZ$3
    it returns #value.

    however when i change $A$2:$FZ$3 with 2:2 (only row 2) the formula works (for the worksheets where the info is in row 2.

    Can anybody tell me what I do wrong (or give me a better solution to my problem?

    Kind regards

    PS: for completeness; this is the formula as a whole:
    =IF(C$2='[Follow-Up.xls]IN'!C$2;'[Follow-Up.xls]IN'!C$1;INDEX('[Follow-Up.xls]IN'!$A$1:$FZ$6000;1;MATCH(C$2;'[Follow-Up.xls]IN'!$A$2:$FZ$3;0)))
    Last edited by Sybie; 03-16-2011 at 11:39 AM.

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

    Re: Matching a value in a different workbook from 2 rows & copy a value from that col

    The MATCH function's lookup range must be a single column or row.. you have a combination.

    MATCH(C$2;'[Follow-Up.xls]IN'!$A$2:$FZ$3;0)

    This Match should find you the row to look in... so it should be:

    MATCH(C$2;'[Follow-Up.xls]IN'!$A$2:$A$3;0)

    then you will need to tell the INDEX function what column to look in to retrieve the value you want... that's the third argument in the INDEX function... You can use a Match there too , like MATCH(X1;'[Follow-Up.xls]IN'!$A$2:$FZ$2;0)
    where X1 contains the column header in row 2 to look for... or if it is a fixed column, then use the column number (much like the VLOOKUP column_index argument)...

    Look at the INDEX and MATCH functions in EXCEL help for more.

    Here is also a good tuturial on using them separately and together as you are trying to do.

    Index Match Tuturial
    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
    Registered User
    Join Date
    03-11-2011
    Location
    Belgium
    MS-Off Ver
    Excel 2007
    Posts
    14

    Post Re: Matching a value in a different workbook from 2 rows & copy a value from that col

    Hi NBVC

    Thanks for your reply.

    If I understand correctly what you are trying to do:
    first look in which row my data is (2 or 3), then look for the correct column, then the row on which my data is (A4:FZ6000)

    When I look at your solution, I see a problem: MATCH(C$2;'[Follow-Up.xls]IN'!$A$2:$A$3;0)

    C2 doesn't necessarily match A2 or A3 it can be A2, FZ2, G3, AA3 or any other column in rows 2 to 3 nor do I have a certainty about what the text in A2 or A3 will be to define this.

    I also read that match could only contain 1 row or column, but I was hoping for a work around (Or that it would make an exception for me ;-))

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

    Re: Matching a value in a different workbook from 2 rows & copy a value from that col

    Can you past a condensed workbook or workbooks showing your requirements?

  5. #5
    Registered User
    Join Date
    03-11-2011
    Location
    Belgium
    MS-Off Ver
    Excel 2007
    Posts
    14

    Post Re: Matching a value in a different workbook from 2 rows & copy a value from that col

    I have made 2 small files:
    1) Original (This is the file handed to me)
    2) Generic (This is the file extracting all the info from Original).

    At the moment, to show how it works, I only used row 2 to look up the references, but I hope to adapt my formulas so that rows 2 & 3 are searched.

    These are not the whole files but the action required is always the same.
    Attached Files Attached Files

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

    Re: Matching a value in a different workbook from 2 rows & copy a value from that col

    I am a little confused as to why looking at only Row 2 in the original isn't good enough.

    In what instance would that not work, and I would need to look at row 3?

  7. #7
    Registered User
    Join Date
    03-11-2011
    Location
    Belgium
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Matching a value in a different workbook from 2 rows & copy a value from that col

    I created a working situation to show what I try to achieve.
    The info in row 2 is sometimes on row 3, sometimes divided over row 2 and 3.
    That is why I want to let it search in the two rows.

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

    Re: Matching a value in a different workbook from 2 rows & copy a value from that col

    Would this work then? In the OUT sheet,B4

    Please Login or Register  to view this content.
    copied down and across the columns

  9. #9
    Registered User
    Join Date
    03-11-2011
    Location
    Belgium
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Matching a value in a different workbook from 2 rows & copy a value from that col

    Thanks for the reply, I'll test it on monday (i only have these files on my office computer).

  10. #10
    Registered User
    Join Date
    03-11-2011
    Location
    Belgium
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Matching a value in a different workbook from 2 rows & copy a value from that col

    I tested it, but if the text is in row 3 it doesn't find it, so this does not seem to be the solution .

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

    Re: Matching a value in a different workbook from 2 rows & copy a value from that col

    Somehow I must have pasted the wrong formula... it is this one I wanted you to try:
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    03-11-2011
    Location
    Belgium
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Matching a value in a different workbook from 2 rows & copy a value from that col

    This seems to work, I will try it tomorrow on some other sheets.
    Already a big thanks.
    I will post feedback as soon as I have tested it thoroughly

  13. #13
    Registered User
    Join Date
    03-11-2011
    Location
    Belgium
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Matching a value in a different workbook from 2 rows & copy a value from that col

    Hi NBVC

    thanks a lot for the proposed solution, it works as a charm.

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

    Re: Matching a value in a different workbook from 2 rows & copy a value from that col

    Great. You are welcome.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

  15. #15
    Registered User
    Join Date
    03-11-2011
    Location
    Belgium
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Matching a value in a different workbook from 2 rows & copy a value from that col

    I was doing it as you were typing :-) (Was reading the FAQ on how to do it :-))
    But you beat me to it :-)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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