+ Reply to Thread
Results 1 to 16 of 16

Comparing and Returning

  1. #1
    Registered User
    Join Date
    09-03-2010
    Location
    Reno, NV
    MS-Off Ver
    Excel 2003
    Posts
    28

    Comparing and Returning

    I have two sheets. On Sheet1 are two columns of numbers. On Sheet2 is a column that matches one of the columns on Sheet1. Here is what I am trying to do:

    If Sheet1:A1 = Sheet2:B1
    then enter Sheet1:B1 into Sheet2:C1

    I know that this is going to take the VLOOKUP function, but I have yet to get it to work.

    Any help would be greatly appreciated!

    Scott
    Last edited by scottdog129; 06-01-2011 at 02:56 PM.

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

    Re: Comparing and Returning

    If you are matching on a row by row basis as you have shown, then you don't need Vlookup. You need: =IF('Sheet1!A1=B1,'Sheet1'!B1,"") copied down.

    But if you want to see if any number in column A of Sheet1 matches B1 of Sheet2, then try:

    =IF(ISNUMBER(MATCH(B1,'Sheet1'!A:A,0)),VLOOKUP(B1,'Sheet1'!A:B,2,FALSE),"")

    or

    =SUMIF('Sheet1'!A:A,B1,'Sheet1'!B:B) if the matches are unique or you want to sum multiple matches...
    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
    09-03-2010
    Location
    Reno, NV
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: Comparing and Returning

    Its just on one single row that Im comparing.

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

    Re: Comparing and Returning

    So does this work, then?:

    =IF('Sheet1!A1=B1,'Sheet1'!B1,"")

  5. #5
    Registered User
    Join Date
    09-03-2010
    Location
    Reno, NV
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: Comparing and Returning

    No, it gives me an error. Let me simplify. Ill give you the exact cells and sheets:

    If contents of Sheet1!ColumnA = FoldInv!ColumnW

    then enter contents of Sheet1!ColumnB into FoldInv!ColumnB

    Hope that helps. Sorry for the confusion.

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

    Re: Comparing and Returning

    I am still a bit confused as the restrictions.

    Are you checking say all of Column A in Sheet1 and comparing to one cell in FoldInv, column W and then copying down to compare column A to the next cell in column W?

    or is it strictly a one cell to one cell matchup?

  7. #7
    Registered User
    Join Date
    09-03-2010
    Location
    Reno, NV
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: Comparing and Returning

    Its just a cell to cell matchup in the same row of both sheets. So:

    If contents of cell2 of Sheet1!ColumnA = contents of cell2 FoldInv!ColumnW

    then enter contents of cell2 Sheet1!ColumnB into cell2 of FoldInv!ColumnB

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

    Re: Comparing and Returning

    Try

    =IF(Sheet1!A2=FoldInv!W2,Sheet1!B2,"")

  9. #9
    Registered User
    Join Date
    09-03-2010
    Location
    Reno, NV
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: Comparing and Returning

    God, I think Im confusing myself here. Im so sorry. Let me try again.

    There is a column of numbers in FoldInv:ColumnW. They look like this in the column:

    12345
    12345
    12345
    12345
    12346
    12346
    12346
    12346
    12347
    12347
    12347
    12347 and so on...

    In the other sheet (Sheet!1) there are two columns B and C. Those numbers look like this:

    ColumnB ColumnC
    12345 66436
    12346 66437
    12347 66438
    12348 66439 and so on...

    What Im wanting to do is look at FoldInv:ColumnW. Whenever that number matches the number in Sheet1:ColumnB to enter the contents of Sheet1:ColumnC into the cell that the formula is entered into.

    I hope that makes more sense. Im not good at wording this stuff very well. Please accept my apologies. And thank you very much for your help!
    Last edited by scottdog129; 05-24-2011 at 04:33 PM.

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

    Re: Comparing and Returning

    You have duplicates in the sample... does sheet1 have duplicates too? Do we need to have different numbers returned beside each duplicate value in column W from Sheet1?

    It would be better if you post a sample workbook showing expected results.... This should eliminate the mutual confusion we are having.

  11. #11
    Registered User
    Join Date
    09-03-2010
    Location
    Reno, NV
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: Comparing and Returning

    Here it is. Hope this helps.
    Attached Files Attached Files

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

    Re: Comparing and Returning

    Since Sheet1 seems to only show unique entries in column B, try:

    =VLOOKUP(B1,Sheet1!$B$1:$C$21,2,FALSE)

    copied down.

  13. #13
    Registered User
    Join Date
    09-03-2010
    Location
    Reno, NV
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: Comparing and Returning

    Here is an except from the actual data:
    Attached Files Attached Files

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

    Re: Comparing and Returning

    Looks like you keep switching the lookup sheet and the database sheet...

    Try:

    =INDEX(Sheet1!B:B,MATCH(W2,Sheet1!C:C,0))

  15. #15
    Registered User
    Join Date
    09-03-2010
    Location
    Reno, NV
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: Comparing and Returning

    Sorry for the delay. Looks like that is it!! Thank you so much for the help!!! You rock!! If I have issues, Ill let you know. Thanks again!

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

    Re: Comparing and Returning

    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

+ 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