+ Reply to Thread
Results 1 to 47 of 47

Vlookup, return column 2 then combine with column 3

  1. #1
    Forum Contributor
    Join Date
    11-01-2018
    Location
    England
    MS-Off Ver
    2016
    Posts
    280

    Vlookup, return column 2 then combine with column 3

    I have simple vlookup formula:
    Please Login or Register  to view this content.
    The table is from A1:C5
    How can the formula be amended to do the following...
    When it returns the value of column 2, how can I also return the 3rd value along and combine the 2 columns together as 1 value?
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,224

    Re: Vlookup, return column 2 then combine with column 3

    Easy peasy:

    =VLOOKUP(E1,A1:C5,2,FALSE)&VLOOKUP(E1,A1:C5,3,FALSE)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Contributor
    Join Date
    11-01-2018
    Location
    England
    MS-Off Ver
    2016
    Posts
    280

    Re: Vlookup, return column 2 then combine with column 3

    Thanks once again ahaha!

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,224

    Re: Vlookup, return column 2 then combine with column 3

    Any more?

    You are welcome.

  5. #5
    Forum Contributor
    Join Date
    11-01-2018
    Location
    England
    MS-Off Ver
    2016
    Posts
    280

    Re: Vlookup, return column 2 then combine with column 3

    Not just yet ahaha

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,224

    Re: Vlookup, return column 2 then combine with column 3

    Until the next time, then. LOL!

  7. #7
    Forum Contributor
    Join Date
    11-01-2018
    Location
    England
    MS-Off Ver
    2016
    Posts
    280

    Re: Vlookup, return column 2 then combine with column 3

    Going back to this problem, I explained it wrong. Instead of searching the first value and combining the other 2 to get the final result...
    I need to combine 2 values together and use that combined value to search. I have attached a better sample workbook.

    Hope this makes sense..
    Attached Files Attached Files

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,224

    Re: Vlookup, return column 2 then combine with column 3

    In P4 copied down:

    =VLOOKUP(VALUE(M4&N4),M$11:M$15,1,0)

  9. #9
    Forum Contributor
    Join Date
    11-01-2018
    Location
    England
    MS-Off Ver
    2016
    Posts
    280

    Re: Vlookup, return column 2 then combine with column 3

    Where did you learn excel?...

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,224

    Re: Vlookup, return column 2 then combine with column 3

    Just by wanting to learn. I've been learning for nearly thirty years. I am a teacher, and as a Head of Department I have to analyse test data by converting grades to values and back again - that's how it started. Initially I shared ideas with other colleagues who were also learning - we liked to compete with each other for the most efficient formula! Lots of time spent helping here since 2013 has honed my skills. I keep a OneNote notebook full of tips that I've learnt from my time here.
    Last edited by AliGW; 02-19-2019 at 07:19 AM.

  11. #11
    Forum Contributor
    Join Date
    11-01-2018
    Location
    England
    MS-Off Ver
    2016
    Posts
    280

    Re: Vlookup, return column 2 then combine with column 3

    How you got time on here as a teacher? And have you tried doing programming?

  12. #12
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,224

    Re: Vlookup, return column 2 then combine with column 3

    I have Sundays and holidays. I am on half term now.

    I don't do VBA, although I use a few simple routines that others here have helped me with. My big love at the moment is Power Query: I am also now responsible for the entire school's data analysis, and I use PQ to normalise data ready to analyse in Power BI. It's great fun! You never stop learning.

    I teach languages, by the way.

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,224

    Re: Vlookup, return column 2 then combine with column 3

    Don't forget to mark this as solved.

  14. #14
    Forum Contributor
    Join Date
    11-01-2018
    Location
    England
    MS-Off Ver
    2016
    Posts
    280

    Re: Vlookup, return column 2 then combine with column 3

    Whats Power Query ? And im trying to compare something, its beyond my excel knowledge but I try to improvise questions on here to get the final result. But obviously learning from it...

  15. #15
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,224

    Re: Vlookup, return column 2 then combine with column 3

    As long as you learn from it, then it's fine to ask, of course - that's part of it.

    Power Query: https://support.office.com/en-us/art...5-89f6269cd605

  16. #16
    Forum Expert boopathiraja's Avatar
    Join Date
    07-12-2013
    Location
    Coimbatore,TamilNadu, India
    MS-Off Ver
    Excel 2007, 2013, 2016, 365
    Posts
    1,455

    Re: Vlookup, return column 2 then combine with column 3

    Quote Originally Posted by AliGW View Post
    I keep a OneNote notebook full of tips that I've learnt from my time here.
    Would you mind sharing it ? ..
    Click just below left if it helps, Boo?ath?

  17. #17
    Forum Contributor
    Join Date
    11-01-2018
    Location
    England
    MS-Off Ver
    2016
    Posts
    280

    Re: Vlookup, return column 2 then combine with column 3

    Last one I hope...
    How would I reverse the formula? Instead of searching from Table 1 search from table 2...

  18. #18
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,224

    Re: Vlookup, return column 2 then combine with column 3

    Would you mind sharing it ? ..
    Yes, I would mind - no, I won't share it, sorry - it's personal and far too much of a mess to make any sense to anyone else, anyway, (it's rather like a digital scrapbook) but you can easily start your own. When you copy and paste ideas from forums, it automatically saves the link, so it becomes a compendium of ideas. I have tabs for different functions. Hope this helps!

  19. #19
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,224

    Re: Vlookup, return column 2 then combine with column 3

    Quote Originally Posted by Eduards View Post
    Last one I hope...
    How would I reverse the formula? Instead of searching from Table 1 search from table 2...
    Not sure what you mean - can you provide an example?

  20. #20
    Forum Contributor
    Join Date
    11-01-2018
    Location
    England
    MS-Off Ver
    2016
    Posts
    280

    Re: Vlookup, return column 2 then combine with column 3

    E.g. search 12 from table 2 and return the value of table 1. Keep in mind the digits from table 1 are double digits not single as they are suppose to be combined
    Attached Files Attached Files

  21. #21
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,224

    Re: Vlookup, return column 2 then combine with column 3

    Do you mean this?

    =VALUE(VLOOKUP(--LEFT(M11,1),M$4:N$8,1,0)&VLOOKUP(--LEFT(M11,1),M$4:N$8,2,0))=M11

    Excel 2016 (Windows) 32 bit
    M
    N
    2
    EXPECTED
    3
    Table 1
    4
    1 2
    5
    2 5
    6
    3 7
    7
    4 9
    8
    5 0
    9
    10
    Table 2
    11
    12
    TRUE
    12
    25
    13
    37
    14
    49
    15
    57
    Sheet: Sheet1

  22. #22
    Forum Contributor
    Join Date
    11-01-2018
    Location
    England
    MS-Off Ver
    2016
    Posts
    280

    Re: Vlookup, return column 2 then combine with column 3

    Yes that's perfect! Reckon you could explain the formula please?

  23. #23
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,224

    Re: Vlookup, return column 2 then combine with column 3

    Yes!

    =VALUE(VLOOKUP(--LEFT(M11,1),M$4:N$8,1,0)&VLOOKUP(--LEFT(M11,1),M$4:N$8,2,0))=M11

    --LEFT(M11,1)

    This looks at the first character (digit) in M11 (which is the leftmost) and using the double-unury -- converts it to a numerical value.

    VLOOKUP(--LEFT(M11,1),M$4:N$8,1,0)


    This searches for --LEFT(M11,1) (which is 1) in the first column of the range M$4:N$8 and returns what it finds in that column(1).

    VLOOKUP(--LEFT(M11,1),M$4:N$8,2,0)


    This searches for --LEFT(M11,1) (which is 1) in the first column of the range M$4:N$8 and returns what it finds in the second column (2).

    &

    This concatenates the two values (1 & 2 = 12).

    VALUE(...)

    This converts the text string (12) into a proper numerical value.

    =M11

    Confirms that what is M11 exists in the lookup range and returns TRUE or FALSE.

  24. #24
    Forum Contributor
    Join Date
    11-01-2018
    Location
    England
    MS-Off Ver
    2016
    Posts
    280

    Re: Vlookup, return column 2 then combine with column 3

    Intresting, I have just tried this formula on the following table. Where Im I going wrong?
    Please Login or Register  to view this content.
    Attached Files Attached Files

  25. #25
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,224

    Re: Vlookup, return column 2 then combine with column 3

    Not sure what you were trying to do!!!

    Excel 2016 (Windows) 32 bit
    A
    B
    1
    Table 1
    2
    501335102286
    2
    3
    501335102287
    9
    4
    501335102288
    6
    5
    501335102289
    3
    6
    501335102290
    9
    7
    8
    Table 2
    9
    5013351022862
    FALSE
    10
    5013351022879
    11
    5013351022886
    12
    5013351022893
    13
    5013351042259
    Sheet: Sheet1

    Excel 2016 (Windows) 32 bit
    B
    9
    =VALUE(VLOOKUP(--LEFT(A9,12),A$2:B$6,1,0)&VLOOKUP(--LEFT(A9,12),A$2:B$6,2,0))=A9
    Sheet: Sheet1

  26. #26
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,224

    Re: Vlookup, return column 2 then combine with column 3

    Did this help?

  27. #27
    Forum Contributor
    Join Date
    11-01-2018
    Location
    England
    MS-Off Ver
    2016
    Posts
    280

    Re: Vlookup, return column 2 then combine with column 3

    Sorry was out for lunch...
    Table 1 Column A is 12 digit barcode and in column B is the check digit for it.

    Table 2 is a full barcode of 13 digits with a check digit combined.

    Im comparing the two if they match or not.

    You might be thinking of using
    Please Login or Register  to view this content.
    But id prefer it in one formula

  28. #28
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,224

    Re: Vlookup, return column 2 then combine with column 3

    That's what my formula in post #25 does.

    You might be thinking of using
    =A2&B2
    Why might I be thinking of using that? And how is that not one formula?

    Please mock up a fresh workbook with everything you want in it. Make it very clear which you consider to be source cells (already in situ) and which are results (i.e. require a formula to produce their result). All mocked up manually, please - no attempted formulae, as that confuses the issue.

  29. #29
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Vlookup, return column 2 then combine with column 3

    The constant activity is a solved thread caught my attention, curiosity got the better of me.

    Is this what you were trying to do?

    =IFERROR(VLOOKUP(VALUE(LEFT(A9,12)),$A$2:$B$6,2,0)=VALUE(RIGHT(A9,1)),"No Match")

  30. #30
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,224

    Re: Vlookup, return column 2 then combine with column 3

    That's essentially what my last formula does, just in a slightly different way.

  31. #31
    Forum Contributor
    Join Date
    11-01-2018
    Location
    England
    MS-Off Ver
    2016
    Posts
    280

    Re: Vlookup, return column 2 then combine with column 3

    ..........
    Attached Files Attached Files

  32. #32
    Forum Contributor
    Join Date
    11-01-2018
    Location
    England
    MS-Off Ver
    2016
    Posts
    280

    Re: Vlookup, return column 2 then combine with column 3

    Hi Jason, thats exactly what I needed. Thanks

  33. #33
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,224

    Re: Vlookup, return column 2 then combine with column 3

    So explain how my formula didn't do what you want? It does the same thing essentially.

  34. #34
    Forum Contributor
    Join Date
    11-01-2018
    Location
    England
    MS-Off Ver
    2016
    Posts
    280

    Re: Vlookup, return column 2 then combine with column 3

    When I pasted the formula in, it gave false value. Whereas Jasons gave what I needed. Im not sure where its going wrong. Im gonna have a look now. Are you referring to formula based inside post #25?

  35. #35
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Vlookup, return column 2 then combine with column 3

    Ali, yours returns false when it should be true, perhaps without the value function...

  36. #36
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,224

    Re: Vlookup, return column 2 then combine with column 3

    Yes, and it is created to return TRUE or FALSE, as explained in post #23. Anyway, never mind - you have got what you need.

  37. #37
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,224

    Re: Vlookup, return column 2 then combine with column 3

    Quote Originally Posted by jason.b75 View Post
    Ali, yours returns false when it should be true, perhaps without the value function...
    The goalposts kept shifting, Jason - I must have lost the thread somewhere along the way.

  38. #38
    Forum Contributor
    Join Date
    11-01-2018
    Location
    England
    MS-Off Ver
    2016
    Posts
    280

    Re: Vlookup, return column 2 then combine with column 3

    Sorry if im confusing anyone here haha, thanks for your help both of you especially Ali . Got a lot today from this post

  39. #39
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,224

    Re: Vlookup, return column 2 then combine with column 3

    That's the main thing. Glad to have helped to some extent.

  40. #40
    Forum Contributor
    Join Date
    11-01-2018
    Location
    England
    MS-Off Ver
    2016
    Posts
    280

    Re: Vlookup, return column 2 then combine with column 3

    One last one for this thread...

    The formula Jason has gave me. How would I add in a "0" before the value. So it just adds on a extra digit before the number

  41. #41
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,224

    Re: Vlookup, return column 2 then combine with column 3

    Maybe like this:

    =IFERROR("0"&VLOOKUP(VALUE(LEFT(A9,12)),$A$2:$B$6,2,0)=VALUE(RIGHT(A9,1)),"No Match")

  42. #42
    Forum Contributor
    Join Date
    11-01-2018
    Location
    England
    MS-Off Ver
    2016
    Posts
    280

    Re: Vlookup, return column 2 then combine with column 3

    Im trying to prefix an extra zero for table 1 without adjusting the table itself. I have tried the formula you gave me with "0".
    Attached Files Attached Files

  43. #43
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,224

    Re: Vlookup, return column 2 then combine with column 3

    Try this:

    =IFERROR(VLOOKUP(VALUE(MID(A9,2,12)),$A$2:$B$6,2,0)=VALUE(RIGHT(A9,1)),"No Match")

  44. #44
    Forum Contributor
    Join Date
    11-01-2018
    Location
    England
    MS-Off Ver
    2016
    Posts
    280

    Re: Vlookup, return column 2 then combine with column 3

    What does the MID do for this current situation? I didn't see a "0"?

  45. #45
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,224

    Re: Vlookup, return column 2 then combine with column 3

    MID(A9,2,12)

    Looks at A9 - starts at the second character (5) and looks at 12 characters from there, so it's looking at this bit of the number (in red): 05013351022862

  46. #46
    Forum Contributor
    Join Date
    11-01-2018
    Location
    England
    MS-Off Ver
    2016
    Posts
    280

    Re: Vlookup, return column 2 then combine with column 3

    I was looking for this few ago ahaha! Even better

  47. #47
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,224

    Re: Vlookup, return column 2 then combine with column 3

    If you have any further queries, please start a new thread. This one has veered massively off course!!!

+ 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. Replies: 4
    Last Post: 11-08-2017, 01:54 PM
  2. Compare multiple columns (column A,column B,Column C) and return value (Column D)
    By john008 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-21-2015, 08:24 AM
  3. Vlookup value in third column of table to return value in first column
    By Jonny757 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-04-2014, 05:31 AM
  4. Replies: 1
    Last Post: 02-20-2014, 08:42 AM
  5. Replies: 0
    Last Post: 11-17-2013, 03:46 PM
  6. Replies: 7
    Last Post: 02-03-2012, 10:06 AM
  7. VLOOKUP: Return value from column left of lookup column?
    By XiaoWei in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-27-2008, 06:17 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