+ Reply to Thread
Results 1 to 13 of 13

comparing values and returning different column

Hybrid View

  1. #1
    Registered User
    Join Date
    10-05-2005
    Posts
    34

    comparing values and returning different column

    Okay so I need some help to return the proper value from sheet 2 into column C in sheet one. I have the current formula set up as an array but I only get the value that matches the first row in Sheet 2.



    HTML Code: 
    Last edited by JustMe602; 06-01-2007 at 10:16 AM.

  2. #2
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127
    How about:

    =VLOOKUP(B2,SHEET2!A1:A100,2,FALSE)

    Let me know if that works

  3. #3
    Registered User
    Join Date
    10-05-2005
    Posts
    34

    the vlookup didn't see to work.

    Due to the values needing to be in ascending order I do believe that is the reason that the Vlookup function will not work in the scenero. Both Sheet 1 & Sheet 2 are not in ascending order based off the information in Column B in Sheet 1 and Column A in Sheet 2.
    Last edited by JustMe602; 06-01-2007 at 10:18 AM.

  4. #4
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127
    It is possible that your lookup range and lookup array are not the same format. If you post a sample of your workbook, it will be easier to specify the problem.

  5. #5
    Valued Forum Contributor
    Join Date
    02-09-2006
    Location
    Melbourne, Australia
    MS-Off Ver
    Office 2016
    Posts
    1,077
    Quote Originally Posted by JustMe602
    Okay so I need some help to return the proper value from sheet 2 into column C in sheet one. I have the current formula set up as an array but I only get the value that matches the first row in Sheet 2.



    HTML Code: 
    The data in sheet1 column B (all commencing with "9") does not match any of the data in sheet2 column A ( all commencing with "5"). I assume these are phone numbers, so to find a match you need to eliminate the area codes from the formula.
    Trish in Oz
    -------------
    A problem well defined is a puzzle half solved


    If you attach a sample of your workbook it will be easier to find a solution. Remember to remove/replace sensitive data before uploading the file. Look here if you need help with attachments:
    http://www.excelforum.com/faq.php?fa...b3_attachments

  6. #6
    Registered User
    Join Date
    10-05-2005
    Posts
    34

    Okay I changed the example...

    In the example of data that I initially supplied the data in sheet2 did not have any values that matched sheet1. I upated the example but still need help with the formula. I don't want to get rid of the the first 3 digits.

    The data in both sheets have the same formating. So that shouldn't be the problem.

    I almost have it in the initial formula, except it only returns column 2 in sheet2 when the information matches the first record in the sheet2.


    Thanks the input of information thus far from everyone.

  7. #7
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127
    VLOOKUP is definitely the function that you need. It's just a matter of applying it.

    What exactly is it doing incorrectly? Are your range set correctly? Did you absolute (use the $ sign) the necessary ranges? (It should look like: =VLOOKUP(B2,SHEET2!$A$1:$A$100,2,FALSE). )

    Other than that, I would again recommend posting a sample of your spreadsheet (use dummy data if your info is confidential).

  8. #8
    Registered User
    Join Date
    10-05-2005
    Posts
    34

    I get #ref! error

    I get the #ref! error when I use the Vlookup function as outlined in the previous post. I have attached an example of the data.
    Attached Files Attached Files

  9. #9
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127
    I see the error, and I initially advised you incorrectly.

    Your lookup range has to encompass all of the data you are looking in. You have:

    =VLOOKUP(B2,Sheet2!$A$1:$A$2000,2,FALSE)

    It should be

    =VLOOKUP(B2,Sheet2!$A$1:$B$2000,2,FALSE)

    Notice the lookup range has changed from A1:A1000 to A1:B1000

  10. #10
    Forum Contributor
    Join Date
    10-27-2006
    Location
    United Kingdom
    MS-Off Ver
    EXCEL 2003 (2007 at home)
    Posts
    517

    Slight mistake by BigBas

    Try VLOOKUP again but with this small modification

    =VLOOKUP(B2,SHEET2!$A$1:$B$100,2,FALSE).

    The previous example was trying to look in the second column of a single column array!
    Hence the #REF error.

    Mark.

  11. #11
    Forum Contributor
    Join Date
    10-27-2006
    Location
    United Kingdom
    MS-Off Ver
    EXCEL 2003 (2007 at home)
    Posts
    517

    Smile BigBas Beat me to it!:

    My typing is too slow.
    rolleyes:

+ 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