+ Reply to Thread
Results 1 to 10 of 10

How to set Vlookup from a string of text in a cell and return the same manner

  1. #1
    Registered User
    Join Date
    02-10-2012
    Location
    Penang, Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    25

    How to set Vlookup from a string of text in a cell and return the same manner

    Hi, I need to vlookup for example from the Whereused column and return the value in a concatenate manner without duplicating the results like the example below shown in the Platform column.. Please help.


    Part Number
    7F4500050-496

    Whereused
    74E191-02-496; 74E126-03-496; 74E151-01-496

    Platform
    Eldec France; Burbank


    Lookup from the table below:

    Model Number
    74E191-02-496
    74E126-03-496
    74E151-01-496

    Platform
    Eldec France
    Eldec France
    Burbank
    Last edited by cathchin; 02-14-2012 at 04:34 AM.

  2. #2
    Registered User
    Join Date
    12-18-2011
    Location
    Back in Warwickshire
    MS-Off Ver
    365
    Posts
    59

    Re: Help!: How to set Vlookup from a string of text in a cell and return the same man

    could you post an example workbook

  3. #3
    Registered User
    Join Date
    02-10-2012
    Location
    Penang, Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    25

    Re: Help!: How to set Vlookup from a string of text in a cell and return the same man

    Alright, here's the attached. Hope you can help me this.
    Attached Files Attached Files

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Help!: How to set Vlookup from a string of text in a cell and return the same man

    Here is a User Defined Function I have called VLOOKUPMANY that works for this. It functions a lot like VLOOKUP, in your sheet the formula would be:

    =VLOOKUPMANY(Value, Range, Column, NoDupes, Delimiter (opt))
    =VLOOKUPMANY(B2, 'Platform Name'!$A:$B, 2, TRUE, "; ")

    In your sample sheet, I also took out the hidden spaces in your column A values on the sheet Platform Name.

    The results are as desired.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  5. #5
    Registered User
    Join Date
    02-10-2012
    Location
    Penang, Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    25

    Re: Help!: How to set Vlookup from a string of text in a cell and return the same man

    Thank you so much for the help! I will give this a try tomorrow when I'm back in my office as all my files are in my company's computer.. This should work... Yay, I'm so happy cos my problem is solved!

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Help!: How to set Vlookup from a string of text in a cell and return the same man

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  7. #7
    Registered User
    Join Date
    02-10-2012
    Location
    Penang, Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    25

    Re: How to set Vlookup from a string of text in a cell and return the same manner

    Hi, i am stucked here. How do i add your code into mine? I have tried and some rules actually clashes the rules that you have set. And when I try to run the code that you gave me, it actually gives me this error message

    This is my current code that I need

    Sub FormatNow()
    '
    'Format Now Macro

    Dim temp2 As Range
    Dim iLastRow As Long
    Dim LastRow As Long
    Dim Raw As Worksheet
    Set Raw = Worksheets("Raw")

    With Range("B:B")
    iLastRow = .Cells(Application.Rows.Count, 1).End(xlUp).Row

    For i = 4 To iLastRow
    temp1 = ""
    Set rRange = .Cells(i, 1)

    If InStr(1, rRange, "(") = 0 Then
    nlen = 0
    temp1 = rRange
    Else
    nlen = Len(rRange)
    End If

    Do While nlen > 1
    nlen = Len(rRange)
    found1 = InStr(1, rRange, "(")
    found2 = InStr(1, rRange, ")")

    temp1 = temp1 + Left(rRange, found1 - 1)
    rRange = Right(rRange, nlen - found2)

    If InStr(1, rRange, "(") = 0 Then
    nlen = 0
    End If
    Loop

    Set temp2 = .Cells(i, 1)
    temp2 = temp1
    Next i
    End With
    Cells.Select
    With Selection
    .HorizontalAlignment = xlGeneral
    .VerticalAlignment = xlBottom
    .WrapText = True
    .Orientation = 0
    .AddIndent = False
    .IndentLevel = 0
    .ShrinkToFit = False
    .ReadingOrder = xlContext
    .MergeCells = False
    End With
    With Selection
    .HorizontalAlignment = xlGeneral
    .VerticalAlignment = xlTop
    .WrapText = True
    .Orientation = 0
    .AddIndent = False
    .IndentLevel = 0
    .ShrinkToFit = False
    .ReadingOrder = xlContext
    .MergeCells = False
    End With
    Range("B:B").Select
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Range("B3").Select
    ActiveCell.FormulaR1C1 = "Description"
    With ActiveCell.Characters(Start:=1, Length:=11).Font
    .Name = "Trebuchet MS"
    .FontStyle = "Regular"
    .Size = 10
    .Strikethrough = False
    .Superscript = False
    .Subscript = False
    .OutlineFont = False
    .Shadow = False
    .Underline = xlUnderlineStyleNone
    .ThemeColor = xlThemeColorLight1
    .TintAndShade = 0
    .ThemeFont = xlThemeFontNone
    End With
    Range("D3").Select
    ActiveCell.FormulaR1C1 = "Platform"
    With ActiveCell.Characters(Start:=1, Length:=8).Font
    .Name = "Trebuchet MS"
    .FontStyle = "Regular"
    .Size = 10
    .Strikethrough = False
    .Superscript = False
    .Subscript = False
    .OutlineFont = False
    .Shadow = False
    .Underline = xlUnderlineStyleNone
    .ThemeColor = xlThemeColorLight1
    .TintAndShade = 0
    .ThemeFont = xlThemeFontNone
    End With

    LastRow = Raw.Cells(Application.Rows.Count, 1).End(xlUp).Row

    Range("B4").Select
    ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-1],'Item Branch'!C[-1]:C,2,0)"
    Range("B4").Select
    Selection.AutoFill Destination:=Range("B4:B" & LastRow)
    Range("B4:B" & LastRow).Select
    Cells.Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False

    I need the vlookupmany to happen in D4

  8. #8
    Registered User
    Join Date
    02-10-2012
    Location
    Penang, Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    25

    Re: How to set Vlookup from a string of text in a cell and return the same manner

    here's the attached as example
    Attached Files Attached Files

  9. #9
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How to set Vlookup from a string of text in a cell and return the same manner

    Grrr... of course there's something new... 192-00333-0002-119(1) and 192-00333-0002-119 are not the same thing, so I taught the new function to strip out any parenthetical strings at the end of each substring before doing the individual Vlookups....

    Please Login or Register  to view this content.


    Here's my version your macro...

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    02-10-2012
    Location
    Penang, Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    25

    Re: How to set Vlookup from a string of text in a cell and return the same manner

    Sorry about that as I thought I can apply your rules after my own macro. Anyway, thanks a million!

+ 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