Cell contain multiple text

Shahuru

New Member
Joined
Dec 4, 2018
Messages
11
Office Version
  1. 2016
Platform
  1. Windows
Hi I need assistance to build a formula for the below scenario,

BB,DN = HB

BB,DN,LN = FB

If cell A1 contains " BB,DN " I want the result to go B1 as " HB" and if cell A1 contains " BB,DN,LN" results to be in B1 as "FB"


BB,DN,LN,
FB
BB,DN
HB

<tbody>
</tbody>


<tbody>
</tbody>
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
There's a lot of ways to do this. And your question is open to some interpretation, so I answered it for a couple of interpretations. There are other tests that may be needed, such as is "bB,dn" also equal to "HB" and so on. If so, post back.

I can't post spreadsheet for some reason, so this gets clunky:

A1: BB,DN
B1: HB
A2: BB,DN,LN
B2: FB

A4: BB,DN,LN
If you have a lot of data and the text is an exact match
B4: =IF(ISNA(VLOOKUP(A4,$A$1:$B$2,1,FALSE)),"Not found",VLOOKUP(A4,$A$1:$B$2,2,FALSE))

A5: abcBB,DNxyz
If text is within what you are examining
B5: =IF(OR(ISERR(FIND(A1,A5)),ISERR(FIND(A2,A5))),"Not found",IF(FIND(A1,A5),B1,IF(FIND(A2,A5),B2,"Not found")))
 
Last edited:
Upvote 0
How about


Book1
AB
1BB,Dn,Ln,FB
2bb,DNHB
3aa,BB,DNHB
4aa,bb,dn,LJHB
5aa,bb,dn,ln,xxFB
Sheet2
Cell Formulas
RangeFormula
B1=IF(ISNUMBER(SEARCH("BB,DN,LN",A1)),"FB",IF(ISNUMBER(SEARCH("BB,DN",A1)),"HB",""))
 
Upvote 0
@ACommandLineKindaGuy
Your B5 formula will return "not found", even if A5 equals either A1 or A2. Even if you make that change if A5=A2 then the formula will return #VALUE!
 
Last edited:
Upvote 0
Suppose your date in column(a),starting with A1
Try this formula
Code:
=IF(A1="","",IFERROR(INDEX({"HB";"FB"},CHOOSE(SUM(IF(A1="BB,DN",1,0),IF(A1="BB,DN,LN",2,0)),1,2)),"No Match"))
AB
1BB,DNHB
2BB,DN,LNFB
3BB,DN,LN,145No Match

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

Worksheet Formulas
CellFormula
B1=IF(A1="","",IFERROR(INDEX({"HB";"FB"},CHOOSE(SUM(IF(A1="BB,DN",1,0),IF(A1="BB,DN,LN",2,0)),1,2)),"No Match"))

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

<tbody>
</tbody>
 
Upvote 0
You could slim that formula down slightly like
=IF(A1="","",IFERROR(INDEX({"HB";"FB"},IF(A1="BB,DN",1,IF(A1="BB,DN,LN",2,""))),"No Match"))
 
Upvote 0
How weird--It worked in the worksheet I had to transcribe once I saw I had no privilege to upload files...
 
Upvote 0
I wanted the result to be ; if the cell contains, DN BB the result should get HB , eg if in Cell A1 has BB TR,GT,LN,KR,DN, - as DN and BB is in the cell i would like only search for those two and result to HB, in most case other character will be there in the cell. hence just wanted to search for specific text and the results to be based as follow.

DN LN BB ( may not be in same pattern) - result to FB
DN BB ( may not be in same pattern) - result to HB
DN WN LQ BR LN BB ( may not be in same pattern) - result to AI

Thanks for your help.
 
Upvote 0
For future reference it's always best to give an accurate description of your data & your needs in the original post, to save members wasting their time providing something that won't work.

That said can you please do that now? Thanks
 
Upvote 0
My apologies for not described it in my initial post; I have list of data contains multiple texts in each cell, out of it i wanted to take few texts and results to be as follow examples.

Cell A1 - DN, BB , TK, GR
Cell A2 - BB,TG,LN,UPY, BR , LQ
Cell A3 - AH, LN, WN,BR ,BB , LQ,DN
Cell A4- BB, DN , TK, GR

If DN and BB found Result to be HB
IF DN BB LN found results to be FB
if LN DN BB WN LQ BR found results to be AI

Thanks for the support.
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,732
Members
448,987
Latest member
marion_davis

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