vlookup/search/find values within a text cell

TJ1982

New Member
Joined
Aug 22, 2019
Messages
2
Hi, Newbie tothe forum and basic Excel user.

From a text cell (Column A) I am struggling to extract the Cost Centre(Column B) and report the Project Name (Column C).

In the table below, I need to see if the values in column B "CostCentre" exist in any part of the cells in column A "Cost Code",and if they do then report the text in column C "Project".

i.e. does "100000" exist in any of the cells in column A, if so report"Project 1" in the relevant cells.

I don't think a simple vlookup or find/search formula can do this?

Is there a way it can be done backwards? i.e. vlookup if any of the valueswithin each cell in column A exist in column B, if they do report the correspondingvalue found in column C.

To be clear columns B and C are related to each other i.e.
Cost Centre 100000is Project 1.

Thanks in advance.



Tom.


Cost Code
Cost Centre
Project
16586/100000/54545
100000
Project 1
100006
100001
Project 2
16586 100002/54547
100002
Project 3
16586/100003/545HB
100003
Project 4
16586/100001/54549
100004
Project 5
16586 :100005/54550
100005
Project 6
16586/100004/54551
100006
Project 7
100008/54552
100007
Project 8
16586/100007/545.53
100008
Project 9
16586 /100009/54554
100009
Project 10
16586/100010/545.55
100010
Project 11
<tbody> </tbody>




 

Some videos you may like

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Gerald Higgins

Well-known Member
Joined
Mar 26, 2007
Messages
9,115
I can't think of a simple way to do this, particularly as the inputs seem to follow an irregular pattern.

If you could write some rules to identify the cost centre within the inputs, then you could write a formula to isolate the cost centre from the inputs, and then lookup the cost centre against your reference table.

A possible rule to do this could be as follows
1) If the input contains the text string "/5", then take the preceding 6 digits as the cost centre.
2) If the input does NOT contain the text string "/5", then use the entire input as the cost centre.

This seems to be right for the sample data you provided, and if so it can be written as a formula.

QUESTION - is this ruleset correct for ALL your data ?
If yes, great, we can use that.
If no, is the amount of further variation small, so that we can adapt the ruleset to deal with one or two more variations ?
Or is the further variation huge, to the extent that it will not be possible to create a reliable ruleset in this way ?
 

TJ1982

New Member
Joined
Aug 22, 2019
Messages
2
Thanks for the reply.

Unfortunately the variation is huge and un-uniform in its format. Isolating the cost centre is my challenge, which is why I was hoping there was a way to a type of reverse vlookup or find formula.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
42,555
Office Version
365
Platform
Windows
One option, with a helper column
<b></b><table cellpadding="2.5px" rules="all" style=";background-color: rgb(255,255,255);border: 1px solid;border-collapse: collapse; border-color: rgb(187,187,187)"><colgroup><col width="25px" style="background-color: rgb(218,231,245)" /><col /><col /><col /><col /><col /></colgroup><thead><tr style=" background-color: rgb(218,231,245);text-align: center;color: rgb(22,17,32)"><th></th><th>A</th><th>B</th><th>C</th><th>D</th><th>E</th></tr></thead><tbody><tr ><td style="color: rgb(22,17,32);text-align: center;">1</td><td style="font-weight: bold;;">Cost Code</td><td style="font-weight: bold;;">Cost Centre</td><td style="font-weight: bold;;">Project</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">2</td><td style=";">16586/100000/54545</td><td style="text-align: center;;">100000</td><td style=";">Project 1</td><td style=";">16586/100000/54545</td><td style=";">Project 1</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">3</td><td style="text-align: right;;">100006</td><td style="text-align: center;;">100001</td><td style=";">Project 2</td><td style=";">16586/100001/54549</td><td style=";">Project 7</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">4</td><td style=";">16586 100002/54547</td><td style="text-align: center;;">100002</td><td style=";">Project 3</td><td style=";">16586 100002/54547</td><td style=";">Project 3</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">5</td><td style=";">16586/100003/545HB</td><td style="text-align: center;;">100003</td><td style=";">Project 4</td><td style=";">16586/100003/545HB</td><td style=";">Project 4</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">6</td><td style=";">16586/100001/54549</td><td style="text-align: center;;">100004</td><td style=";">Project 5</td><td style=";">16586/100004/54551</td><td style=";">Project 2</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">7</td><td style=";">16586 :100005/54550</td><td style="text-align: center;;">100005</td><td style=";">Project 6</td><td style=";">16586 :100005/54550</td><td style=";">Project 6</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">8</td><td style=";">16586/100004/54551</td><td style="text-align: center;;">100006</td><td style=";">Project 7</td><td style="text-align: right;;">100006</td><td style=";">Project 5</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">9</td><td style=";">100008/54552</td><td style="text-align: center;;">100007</td><td style=";">Project 8</td><td style=";">16586/100007/545.53</td><td style=";">Project 9</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">10</td><td style=";">16586/100007/545.53</td><td style="text-align: center;;">100008</td><td style=";">Project 9</td><td style=";">100008/54552</td><td style=";">Project 8</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">11</td><td style=";">16586 /100009/54554</td><td style="text-align: center;;">100009</td><td style=";">Project 10</td><td style=";">16586 /100009/54554</td><td style=";">Project 10</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">12</td><td style=";">16586/100010/545.55</td><td style="text-align: center;;">100010</td><td style=";">Project 11</td><td style=";">16586/100010/545.55</td><td style=";">Project 11</td></tr></tbody></table><p style="width:10.4em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid rgb(187,187,187);border-top:none;text-align: center;background-color: rgb(218,231,245);color: rgb(22,17,32)">Program start</p><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: rgb(255,255,255)" ><tr><td style="padding:6px" ><b>Worksheet Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: rgb(255,255,255);border-collapse: collapse; border-color: rgb(187,187,187)"><thead><tr style=" background-color: rgb(218,231,245);color: rgb(22,17,32)"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: rgb(218,231,245);color: rgb(22,17,32)">E2</th><td style="text-align:left">=INDEX(<font color="Blue">$C$2:$C$12,MATCH(<font color="Red">A2,$D$2:$D$12,0</font>)</font>)</td></tr></tbody></table></td></tr></table><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: rgb(255,255,255)" ><tr><td style="padding:6px" ><b>Array Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: rgb(255,255,255);border-collapse: collapse; border-color: rgb(187,187,187)"><thead><tr style=" background-color: rgb(218,231,245);color: rgb(22,17,32)"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: rgb(218,231,245);color: rgb(22,17,32)">D2</th><td style="text-align:left">{=INDEX(<font color="Blue">$A$2:$A$12,MATCH(<font color="Red">"*"&B2&"*",$A$2:$A$12&"",0</font>)</font>)}</td></tr></tbody></table><b>Entered with Ctrl+Shift+Enter.</b> If entered correctly, Excel will surround with curly braces {}.
<b>Note: Do not try and enter the {} manually yourself</b></td></tr></table><br />
 

Watch MrExcel Video

Forum statistics

Threads
1,102,202
Messages
5,485,319
Members
407,496
Latest member
PttrsnMrgn

This Week's Hot Topics

  • Finding issue in If elseif else with For each Loop
    Finding issue in If elseif else with For each Loop I have tried this below code but i'm getting in Y column filled with W005. Colud you please...
  • MsgBox Error
    Hi Guys, I have the below error show up when i try and run my macro in File1 but works fine if i copy and paste the same code into file2. [ATTACH...
  • CELL FORMAT - IF CONDITION
    My Cell Format is [B]""0.00" Cr". [/B]But in the cell, it is showing 123.00 for editing. (123 is entry figure). (Data imported from other...
  • Show numbers nearly the same
    Is this possible. I have a number that can change very time eg 0.00001234 Then I have a lot of numbers 0.0000001, 0.0000002, 0.00000004...
  • Please i need your help to create formula
    I need a formula in cell B8 to do this >>if b1=1 then multiply ( cell b8) by 10% ,if b1=2 multiply by 20%,if=3 multiply by 30%. Thank you in...
  • Got error while adding column and filter
    Got error while adding column and filter In column Z has some like "Success" and "Error". I want to add column in AA if the Z cell value is...
Top