+ Reply to Thread
Results 1 to 18 of 18

Do a vlookup based on left 6 numbers in the table

  1. #1
    Registered User
    Join Date
    06-18-2010
    Location
    Orange Park, FL
    MS-Off Ver
    Office 365
    Posts
    78

    Do a vlookup based on left 6 numbers in the table

    On the collections tab in Column L... I want it to look up the left 6 characters of Column D and if it finds those numbers (with or without a .#) in AR tab Column C, I want it to put a "N", if it doesn't find it, I want it to put a "Y".
    Attached Files Attached Files
    Last edited by kafarrell; 07-30-2014 at 10:25 AM.

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,082

    Re: Do a vlookup based on left 6 numbers in the table

    Column K in the collections tab is "Net Amount Received" and contains figures.
    Are you sure you want these figures overwritten with a Y/N ?

    Try (untested)
    =IF(ISNA(VLOOKUP(LEFT(D10,6),AR!C$6:C$1000,0)),"N","Y")
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Do a vlookup based on left 6 numbers in the table

    Try

    =IF(SUMPRODUCT(--(LEFT(AR!$C$6:$C$100,6)=LEFT(D10,6))),"N","Y")

  4. #4
    Registered User
    Join Date
    06-18-2010
    Location
    Orange Park, FL
    MS-Off Ver
    Office 365
    Posts
    78

    Re: Do a vlookup based on left 6 numbers in the table

    Sorry... changed post to Column L

  5. #5
    Registered User
    Join Date
    06-18-2010
    Location
    Orange Park, FL
    MS-Off Ver
    Office 365
    Posts
    78

    Re: Do a vlookup based on left 6 numbers in the table

    Quote Originally Posted by Special-K View Post
    Column K in the collections tab is "Net Amount Received" and contains figures.
    Are you sure you want these figures overwritten with a Y/N ?

    Try (untested)
    =IF(ISNA(VLOOKUP(LEFT(D10,6),AR!C$6:C$1000,0)),"N","Y")
    Sorry... changed post to Column L, but that formula did not work.

  6. #6
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Do a vlookup based on left 6 numbers in the table

    In Row 10 of Collections sheet

    =SUM(COUNTIF(AR!C:C,INDEX(CHOOSE({1,2},--LEFT(D10),D10),,N(IF(1,{1,2})))))

    Drag it down....


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  7. #7
    Registered User
    Join Date
    06-18-2010
    Location
    Orange Park, FL
    MS-Off Ver
    Office 365
    Posts
    78

    Re: Do a vlookup based on left 6 numbers in the table

    Quote Originally Posted by :) Sixthsense :) View Post
    In Row 10 of Collections sheet

    =SUM(COUNTIF(AR!C:C,INDEX(CHOOSE({1,2},--LEFT(D10),D10),,N(IF(1,{1,2})))))

    Drag it down....
    That put a $ - in the Column L

  8. #8
    Registered User
    Join Date
    06-18-2010
    Location
    Orange Park, FL
    MS-Off Ver
    Office 365
    Posts
    78

    Re: Do a vlookup based on left 6 numbers in the table

    Quote Originally Posted by Jonmo1 View Post
    Try

    =IF(SUMPRODUCT(--(LEFT(AR!$C$6:$C$100,6)=LEFT(D10,6))),"N","Y")
    That worked! Can you explain it to me by chance?

  9. #9
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Do a vlookup based on left 6 numbers in the table

    Quote Originally Posted by kafarrell View Post
    That put a $ - in the Column L
    Oopss.... I Forgot to add an IF... Try this...

    =IF(SUM(COUNTIF(AR!C:C,INDEX(CHOOSE({1,2},--LEFT(D10),D10),,N(IF(1,{1,2}))))),"N","Y")

  10. #10
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Do a vlookup based on left 6 numbers in the table

    Quote Originally Posted by kafarrell View Post
    That worked! Can you explain it
    You're welcome.

    It compares the left 6 characters of D10 to the left 6 characters of all the values in C6:C100.
    And it counts how many of them match.
    If that count is 0, it returns Y, if it's greater than 0 it returns N

  11. #11
    Registered User
    Join Date
    06-18-2010
    Location
    Orange Park, FL
    MS-Off Ver
    Office 365
    Posts
    78

    Re: Do a vlookup based on left 6 numbers in the table

    Quote Originally Posted by :) Sixthsense :) View Post
    Oopss.... I Forgot to add an IF... Try this...

    =IF(SUM(COUNTIF(AR!C:C,INDEX(CHOOSE({1,2},--LEFT(D10),D10),,N(IF(1,{1,2}))))),"N","Y")
    That worked too! Thanks!

  12. #12
    Registered User
    Join Date
    06-18-2010
    Location
    Orange Park, FL
    MS-Off Ver
    Office 365
    Posts
    78

    Re: Do a vlookup based on left 6 numbers in the table

    Quote Originally Posted by Jonmo1 View Post
    You're welcome.

    It compares the left 6 characters of D10 to the left 6 characters of all the values in C6:C100.
    And it counts how many of them match.
    If that count is 0, it returns Y, if it's greater than 0 it returns N
    What is the --?

  13. #13
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Do a vlookup based on left 6 numbers in the table

    -- Converts True/False values into 1/0 values
    True = 1, False = 0

    (LEFT(AR!$C$6:$C$100,6)=LEFT(D10,6))
    This is an expression (or question) withe a True or False answer.
    It reads 1 row at a time, and asks Is the left 6 characters from column C equal to the left 6 characters of D10? True or False.
    It creates an array of all the True/False results of that question for each cell in C6:C100
    The -- converts those True/False into 1/0
    Then the sumproduct SUMS those 1's and 0's.
    If that sum is 0, it returns "Y"
    If that sum is any number greater than 0, it returns "N"

  14. #14
    Registered User
    Join Date
    06-18-2010
    Location
    Orange Park, FL
    MS-Off Ver
    Office 365
    Posts
    78

    Re: Do a vlookup based on left 6 numbers in the table

    Quote Originally Posted by Jonmo1 View Post
    -- Converts True/False values into 1/0 values
    True = 1, False = 0

    (LEFT(AR!$C$6:$C$100,6)=LEFT(D10,6))
    This is an expression (or question) withe a True or False answer.
    It reads 1 row at a time, and asks Is the left 6 characters from column C equal to the left 6 characters of D10? True or False.
    It creates an array of all the True/False results of that question for each cell in C6:C100
    The -- converts those True/False into 1/0
    Then the sumproduct SUMS those 1's and 0's.
    If that sum is 0, it returns "Y"
    If that sum is any number greater than 0, it returns "N"
    Thanks so much! I'm learning... slowly, but surely.

  15. #15
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Do a vlookup based on left 6 numbers in the table

    you could probably just use INT()
    =IF(SUMPRODUCT(--(INT(AR!$C$6:$C$100)=INT(D10))),"N","Y")
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  16. #16
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Do a vlookup based on left 6 numbers in the table

    Quote Originally Posted by martindwilson View Post
    you could probably just use INT()
    I considered that as well, but it will error if there are any text values in C6:C100...

    It also assumes that all the numbers are 6 digits (not including the decimal value).

    So if D10 was say 123456.7
    And you had 12345678.9 in C20 or whatever, then it wouldn't be a match.
    But it is a match using the left function.
    But we don't know if that's desireable or not....

  17. #17
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Do a vlookup based on left 6 numbers in the table

    int() works just fine on text numbers

  18. #18
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Do a vlookup based on left 6 numbers in the table

    But not on actual Text like "hello".

    Just forward thinking in case there are actual text strings mixed up in the range.

+ 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] How to populate a table with names based on cell numbers.
    By SGT in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-13-2014, 05:56 AM
  2. [SOLVED] vlookup table array and column index number to the left
    By Mengo85 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-19-2012, 08:24 AM
  3. Replies: 5
    Last Post: 05-11-2012, 06:40 AM
  4. Vlookup based on table.
    By slashdot in forum Excel General
    Replies: 8
    Last Post: 04-19-2012, 08:45 AM
  5. query within vlookup table aray to retrive left 6
    By Shevyfan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-26-2011, 01:36 PM

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