Help with a lookup based on multiple values in a single cell

will0r

New Member
Joined
Jun 29, 2021
Messages
2
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2013
  5. 2010
Platform
  1. Windows
  2. MacOS
Hi everyone,

I'm not exactly sure how to even ask this properly but hopefully my image and little explanation will be enough to get started!

What I'm trying to achieve is to take the values from Table 1 (with Column A) and perform a lookup into Table 2 (via Column D) and return the full-description (from Column E) back to Table 1 (place them all in Column B).

Excel1.png


Hopefully there's a suitable solution for this as I think, well actually, I know I am struggling with this one!

Appreciate all the help in advance. Thanks!
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Welcome to the MrExcel forum!

Are all those codes in column A? And you're looking to find the matching code for all of them? If so, try:

Book1
ABCDE
1Notification StatusFull StatusStatStatus
2NOPR NOTI NOPT INITInitialized, Not prompt, Not initialized, No parts1100Can be archived
3NOPR NOTI INIT DSGN QLTY MFGInitialized, Designed, Manufactured, Not prompt, Not initialized, Quality department advisedAALKAccount assignment locked
4ABCD NOPR INITcode ABCD, Initialized, Not promptABCDcode ABCD
5AB INITcode AB, InitializedABcode AB
6EFGH ABCD ABcode ABCD, code AB, code EFGHEFGHcode EFGH
7AB UNK XYZ INITcode AB, InitializedINITInitialized
8UNK XYZ DSGNDesigned
9 MFGManufactured
10 NOPRNot prompt
11NOTINot initialized
12NOPTNo parts
13QLTYQuality department advised
14
15
Sheet6
Cell Formulas
RangeFormula
B2:B10B2=TEXTJOIN(", ",1,IF(ISNUMBER(SEARCH(" "&$D$2:$D$20&" "," "&A2&" "))*(A2<>""),$E$2:$E$20,""))


TEXTJOIN was added to Excel in the 2019 version, so this only works in 2019 or newer. A few things to note, the Full Status will be in the order of the table, not necessarily the order of the entry in column A. Also, if there is an unknown code (A7 and A8), there is no indication.


FYI, there's a tool here called XL2BB. It makes it much easier to share your sheet to make it easier for helpers to look at your data and copy it without having to retype everything. Check out the link in the reply box or my signature. It's easy to download, install, and use.
 
Upvote 0
Welcome to the MrExcel forum!

Are all those codes in column A? And you're looking to find the matching code for all of them? If so, try:

Book1
ABCDE
1Notification StatusFull StatusStatStatus
2NOPR NOTI NOPT INITInitialized, Not prompt, Not initialized, No parts1100Can be archived
3NOPR NOTI INIT DSGN QLTY MFGInitialized, Designed, Manufactured, Not prompt, Not initialized, Quality department advisedAALKAccount assignment locked
4ABCD NOPR INITcode ABCD, Initialized, Not promptABCDcode ABCD
5AB INITcode AB, InitializedABcode AB
6EFGH ABCD ABcode ABCD, code AB, code EFGHEFGHcode EFGH
7AB UNK XYZ INITcode AB, InitializedINITInitialized
8UNK XYZ DSGNDesigned
9 MFGManufactured
10 NOPRNot prompt
11NOTINot initialized
12NOPTNo parts
13QLTYQuality department advised
14
15
Sheet6
Cell Formulas
RangeFormula
B2:B10B2=TEXTJOIN(", ",1,IF(ISNUMBER(SEARCH(" "&$D$2:$D$20&" "," "&A2&" "))*(A2<>""),$E$2:$E$20,""))


TEXTJOIN was added to Excel in the 2019 version, so this only works in 2019 or newer. A few things to note, the Full Status will be in the order of the table, not necessarily the order of the entry in column A. Also, if there is an unknown code (A7 and A8), there is no indication.


FYI, there's a tool here called XL2BB. It makes it much easier to share your sheet to make it easier for helpers to look at your data and copy it without having to retype everything. Check out the link in the reply box or my signature. It's easy to download, install, and use.

Eric, thank you greatly for your help on this! Out of curiosity, is there a way I can allow for Full Status to ordered as per Status in Column A? If there's a bit of prep work involved, that's fine too!

Cheers!
 
Upvote 0
If a UDF (User Defined Function) is acceptable, try

Paste the code below In a Standard Module
VBA Code:
Function FullStatus(s As String, r As Range) As String
    Dim spl As Variant, rFound As Range, sAux As String
    Dim i As Long
  
    spl = Split(Application.Trim(s), " ")
    For i = LBound(spl) To UBound(spl)
        Set rFound = r.Find(what:=spl(i), LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, _
                SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
        If Not rFound Is Nothing Then sAux = sAux & rFound.Offset(, 1) & ", "
    Next i
    If Len(sAux) > 0 Then FullStatus = Left(sAux, Len(sAux) - 2)
End Function

30062021 Testes.xlsm
ABCDE
1Notification StatusFull StatusStatStatus
2NOPR NOTI NOPT INITNot prompt, Not initialized, No parts, Initialized1100Can be archived
3NOPR NOTI INIT DSGN QLTY MFGNot prompt, Not initialized, Initialized, Designed, Quality department advised, ManufacturedAALKAccount assignment locked
4ABCD NOPR INITcode ABCD, Not prompt, InitializedABCDcode ABCD
5AB INITcode AB, InitializedABcode AB
6EFGH ABCD ABcode EFGH, code ABCD, code ABEFGHcode EFGH
7AB UNK XYZ INITcode AB, InitializedINITInitialized
8UNK XYZ DSGNDesigned
9DSGNDesignedMFGManufactured
10NOPRNot prompt
11NOTINot initialized
12NOPTNo parts
13QLTYQuality department advised
Plan4
Cell Formulas
RangeFormula
B2:B9B2=FullStatus(A2,D$2:D$13)


Save the file as .xlsm

Hope this helps

M.
 
Last edited:
Upvote 0
How about:

Book1
ABCDE
1Notification StatusFull StatusStatStatus
2NOPR NOTI NOPT INITNot prompt, Not initialized, No parts, Initialized1100Can be archived
3NOPR NOTI INIT DSGN QLTY MFGNot prompt, Not initialized, Initialized, Designed, Quality department advised, ManufacturedAALKAccount assignment locked
4ABCD NOPR INITcode ABCD, Not prompt, InitializedABCDcode ABCD
5AB INITcode AB, InitializedABcode AB
6EFGH ABCD ABcode EFGH, code ABCD, code ABEFGHcode EFGH
7AB UNK XYZ INITcode AB, InitializedINITInitialized
8UNK XYZ DSGNDesigned
9 MFGManufactured
10 NOPRNot prompt
11NOTINot initialized
12NOPTNo parts
13QLTYQuality department advised
14
Sheet6
Cell Formulas
RangeFormula
B2:B10B2=TEXTJOIN(", ",1,IFERROR(VLOOKUP(TRIM(MID(SUBSTITUTE(A2," ",REPT(" ",100)),SEQUENCE(100,,1,100),100)),$D$2:$E$20,2,0),""))


But this version only works in Excel 365.
 
Upvote 0

Forum statistics

Threads
1,214,971
Messages
6,122,520
Members
449,088
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top