Dynamic If Contains specific String then return said Original String

jross20

New Member
Joined
Apr 8, 2016
Messages
17
Office Version
  1. 365
  2. 2021
  3. 2019
Platform
  1. Windows
Hey guys, it has been a while since I've needed any help but I've ran into a wall today. Basically, I need to be able to figure out which customer is which from a long "site ID".

So say that the first one is "Cust1A/SITE-5" , I have a table full of each customers short name and then matching project name on another tab. So say this table says Customer-A's project is "Customer 1-A Main Project".

I need excel to return to me which customer is which from the first cell based on whether it contains the short name for the customer. The short names will NOT always be the same length or at the same position.
Customer Short NameProject NameSite IDProject Name
Cust1ACustomer 1-A Main ProjectCust1A/SITE-5Needs to return matching customer project name
Cust2BCustomer 2-B Main ProjectCust2B/SITE-56Needs to return matching customer project name

<tbody>
</tbody>

I've spent an hour trying to what feels really simple but I've no idea how to make this work. The thing is it cannot have the names locked into the formulas, I need to to be dynamic as the list of customers and projects grow.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Hi,

If I understand correctly, this should help:


Excel 2010
ABCD
1Customer Short NameProject NameSite IDProject Name
2Cust1ACustomer 1-A Main ProjectCust1A/SITE-5Customer 1-A Main Project
3Cust2BCustomer 2-B Main ProjectCust2B/SITE-56Customer 2-B Main Project
Sheet4
Cell Formulas
RangeFormula
D2=INDEX(B$2:B$3,MATCH("*"&A2&"*",C$2:C$3,0))


D2 formula copied down.
Since your data is spread over a few different tabs, add tab names as appropriate.
 
Upvote 0
Hi there. A couple of things:

1. Can you use macros/subroutines?
2. How will you match these 3 lists? Will the user match only 1 customer short name at a time or do they need to match a list of short names?

The formula version is (assuming these are columns A-C):


Code:
=index(B:B,match(custshortname, A:A,0))
 
Upvote 0
Hi there. A couple of things:

1. Can you use macros/subroutines?
2. How will you match these 3 lists? Will the user match only 1 customer short name at a time or do they need to match a list of short names?

The formula version is (assuming these are columns A-C):


Code:
=index(B:B,match(custshortname, A:A,0))


Each line is unique for each customers site. So like Customer-A/1 and then Customer-A/2 and so on. There can be multiple customers, so Row A can can grow.
There will never be a duplicate site in this list

There is an input sheet where the user will dump raw data into, the rest of the sheet will auto fill based on that. The first reply ALMOST works but gets some of them wrong.

After thinking about it I realized an easier way to ask the question, basically "Hey excel do each of these cells contain any of the strings from this column? If so tell me WHICH string it finds". That would be enough for me to match and index my way to victory.

(would like to avoid VBA if possible, some work computers are almost too slow to even run excel in the first place)
 
Last edited:
Upvote 0
Hi,

If I understand correctly, this should help:

Excel 2010
ABCD
1Customer Short NameProject NameSite IDProject Name
2Cust1ACustomer 1-A Main ProjectCust1A/SITE-5Customer 1-A Main Project
3Cust2BCustomer 2-B Main ProjectCust2B/SITE-56Customer 2-B Main Project

<colgroup><col style="width: 25pxpx"><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet4

Worksheet Formulas
CellFormula
D2=INDEX(B$2:B$3,MATCH("*"&A2&"*",C$2:C$3,0))

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>



D2 formula copied down.
Since your data is spread over a few different tabs, add tab names as appropriate.


This almost works but gets a few wrong. I am still experimenting.
 
Upvote 0

Forum statistics

Threads
1,216,503
Messages
6,131,020
Members
449,615
Latest member
Nic0la

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