Lookup Numbers & Result in Corresponding Text

mohdamir1989

New Member
Joined
Oct 17, 2017
Messages
42
Hi All,

Is it possible to lookup a string of numbers in any cell from other workbook and result in the corresponding text (Excel 2007)

Thank you in advance.


For example:

Lookup CellResult
1, 2, 4, 12, 14Relay burnt, Capacitor Burnt, Suction Joint Gas leak, Overload burnt, Thermostat dead

<tbody>
</tbody>


Helper Sheet

Sr No.Fault & Diagnosing
1Relay burnt
2Capacitor burnt
4Suction Joint Gas leak
51/3 Compressor low pressure
61/4 Compressor ceased
71/3 Condenser Leak
8Capillary broken
9Voltage problem
10Suction Joint Gas leak
11Gas leak
12Overload Burnt
13Overlaod faulty
14Thermostat dead

<colgroup><col><col></colgroup><tbody>
</tbody>
 
Glad we could help & thanks for the feedback.

If you have Office 365 then it might be possible with TextJoin, other than that, it might be possible with a shed load of helper columns.
Formulae aren't my strong suit so not sure.

Sorry for almost no knowledge about VBA. There's one more query to the same task

Can results be expanded like

Sr No.Fault & DiagnosingFault & Diagnosing
1Relay burntRelay replaced
2Capacitor burntCapacitor replaced
4Suction Joint Gas leakGas charged
51/3 Compressor low pressure1/3 Compressor replaced
61/4 Compressor ceased1/4 Compressor replaced
71/3 Condenser Leak1/3 Condenser replaced
8Capillary brokenGas charged
9Voltage problemVoltage problem
10Suction Joint Gas leakGas charged
11Gas leakGas charged
12Overload BurntOverload Replaced
13Overlaod faultyOverload Replaced
14Thermostat deadThermostat replaced

<tbody>
</tbody>

I tried to change these two lines

".Item(Cl.Value) = Cl.Offset(, 2).Value
Cl.Offset(, 2).Value = Tmp"

Which resulted as below:

Lookup CellResultResult
1, 2, 4, 12, 14 Relay replaced, Capacitor replaced, Gas charged, Overload Burnt, Thermostat dead
1,Relay replaced
1,Relay replaced
1, 2, 4, 12, 19Relay replaced, Capacitor replaced, Gas charged, Overload Burnt,

<colgroup><col><col><col></colgroup><tbody>
</tbody>

I don't know to mention both at the same time.
 
Upvote 0

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
How about
Code:
Sub MyConcat()
   Dim Cl As Range
   Dim Sws As Worksheet, Mws As Worksheet
   Dim Wrds As Variant, Tmp As Variant, Tmp2 As Variant
   Dim i As Long
   
   Set Sws = Workbooks("book1.xlsm").Sheets("List")
   Set Mws = Sheets("Sheet3")
   With CreateObject("scripting.dictionary")
      For Each Cl In Sws.Range("A2", Sws.Range("A" & Rows.Count).End(xlUp))
         .Item(Cl.Value) = Array(Cl.Offset(, 1).Value, Cl.Offset(, 2).Value)
      Next Cl
      For Each Cl In Mws.Range("A2", Mws.Range("A" & Rows.Count).End(xlUp))
         Wrds = Split(Cl.Value, ", ")
         For i = 0 To UBound(Wrds)
            If .Exists(CLng(Wrds(i))) Then
               If Tmp = "" Then
                  Tmp = .Item(CLng(Wrds(i)))(0)
                  Tmp2 = .Item(CLng(Wrds(i)))(1)
               Else
                  Tmp = Tmp & ", " & .Item(CLng(Wrds(i)))(0)
                  Tmp2 = Tmp2 & ", " & .Item(CLng(Wrds(i)))(1)
               End If
            End If
         Next i
         Cl.Offset(, 1).Value = Tmp
         Cl.Offset(, 2).Value = Tmp2
         Tmp = "": Tmp2 = ""
      Next Cl
   End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,593
Messages
6,125,715
Members
449,254
Latest member
Eva146

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