Partial Match Text in Cell and Have It Return Text From a Different Cell

OhSheet

New Member
Joined
Oct 7, 2024
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hello, Excel Wizards! Long time lurker, first time poster. :)

I am trying to figure out a way to populate text in the 'Program Details' column based on criteria of the 'Billing Code(s)' column BUT the populated/returned text is data from another tab in the workbook. Is this possible?

I currently have a countif function in place =IF(COUNTIF(A2,"*ABC123*"),"Program details blurb", "") but it doesn't provide me with the ability to pull in data from another cell to populate the result, and would need to put the output text right in the equation. Not 100% ideal as this may be updated quite frequently.

Any advice would be greatly appreciated!

Billing Code(s)Program Details for ABC123
ABC123, DEF456ideally populated from cell on a different tab of the same workbook
ABC123ideally populated from cell on a different tab of the same workbook
ABC135, DEF456, GHI789ideally populated from cell on a different tab of the same workbook
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
You can use a combination of the SEARCH, ISNUMBER, IF, and TEXTJOIN functions to check if a cell contains certain text and then return corresponding data from another sheet. By creating a mapping table of your billing codes and their program details, you can dynamically pull the required information without hardcoding it into your formulas.

=TEXTJOIN(", ", TRUE, IF(ISNUMBER(SEARCH(Sheet2!$A$2:$A$100, A2)), Sheet2!$B$2:$B$100, ""))
 
Upvote 0
Does this do what you want?
2024-10-07.xlsx
AB
1Billing Code(s)Program Details for ABC123
2ABC123, DEF456blurb1
3ABC123blurb1
4ABC135, DEF456, GHI789blurb2
Sheet1
Cell Formulas
RangeFormula
B2:B4B2=INDEX(Sheet2!$A$2:$B$5,MATCH(LEFT(A2,6),Sheet2!$A$2:$A$5,0),2)

2024-10-07.xlsx
AB
1CodeDetails
2ABC123blurb1
3ABC135blurb2
4DEF456blurb3
5GHI789blurb4
Sheet2
 
Upvote 0
Does this do what you want?
2024-10-07.xlsx
AB
1Billing Code(s)Program Details for ABC123
2ABC123, DEF456blurb1
3ABC123blurb1
4ABC135, DEF456, GHI789blurb2
Sheet1
Cell Formulas
RangeFormula
B2:B4B2=INDEX(Sheet2!$A$2:$B$5,MATCH(LEFT(A2,6),Sheet2!$A$2:$A$5,0),2)

2024-10-07.xlsx
AB
1CodeDetails
2ABC123blurb1
3ABC135blurb2
4DEF456blurb3
5GHI789blurb4
Sheet2
Thank you, Jen!! This works for when 'ABC123' is listed first in the string of billing codes. Is there a way to make it work if it's not listed first in the cell? Thanks so much!
 
Upvote 0
Thank you, Jen!! This works for when 'ABC123' is listed first in the string of billing codes. Is there a way to make it work if it's not listed first in the cell? Thanks so much!
Is "ABC123" the only string that will matter, or will the others sometimes matter? Is there a table of possible outcomes, like the one I built on 'Sheet2'!, or do you always want the text from a specific cell to be referenced if "ABC123" is present in the searched cell?
 
Upvote 0
Does one of these do what you want?
2024-10-07.xlsx
ABCDEF
1value->refref->refref->lookup
2Billing Code(s)Program Details for ABC123ABC123ABC123
3ABC123, DEF456blurb1blurb1blurb1blurb1
4ABC123blurb1blurb2blurb1blurb1
5ABC135, DEF456, GHI789blurb2   
Sheet1
Cell Formulas
RangeFormula
D3:D5D3=IF(COUNTIF(A3,"*ABC123*"),Sheet2!B2, "")
E3:E5E3=IF(ISNUMBER(SEARCH($E$2,A3)),Sheet2!$B$2,"")
F3:F5F3=IF(ISNUMBER(SEARCH($F$2,A3)),INDEX(Sheet2!$A$2:$B$5,MATCH($F$2,Sheet2!$A$2:$A$5,0),2),"")
B3:B5B3=INDEX(Sheet2!$A$2:$B$5,MATCH(LEFT(A3,6),Sheet2!$A$2:$A$5,0),2)

2024-10-07.xlsx
AB
1CodeDetails
2ABC123blurb1
3ABC135blurb2
4DEF456blurb3
5GHI789blurb4
Sheet2
 
Upvote 0
Welcome to posting at the MrExcel board!

Perhaps you could give us a small sample from both sheets (with the expected results manually filled in) with XL2BB and explain the results in relation to the actual sample data?
(If you have trouble with XL2BB, review the "XL2BB Icons greyed out" link in the 'Known XL2BB issues' section near the top of the XL2BB Instructions page linked above.)
 
Upvote 0

Forum statistics

Threads
1,224,846
Messages
6,181,304
Members
453,031
Latest member
Chris_1

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