Search for multiple text strings and return abbreviations if present

mordecai98

New Member
Joined
Jan 17, 2018
Messages
4
In column B, the following options are available:
<style type="text/css"><!--td {border: 1px solid #ccc;}br {mso-data-placement:same-cell;}--></style>Session 1: Sunday July 1st – Friday July 6th, Session 2: Sunday July 8th – Friday July 13th, Session 3: Sunday July 15th – Friday July 20th, Session 4: Sunday July 22nd– Friday July 27th
In column C, if Session 1 is resent, I'd like to display 1. If Session 1 and Session 2 are present, I'd like to display 1,2, etc.

I can do this for just Session 1, but not sure how to do this with all 4 sessions.

Thanks
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
In column B, the following options are available:
Session 1: Sunday July 1st – Friday July 6th, Session 2: Sunday July 8th – Friday July 13th, Session 3: Sunday July 15th – Friday July 20th, Session 4: Sunday July 22nd– Friday July 27th

Is this in one cell or several cells in column B? You haven't specified.

How many sessions can there be as a maximum?
 
Last edited:
Upvote 0
<style type="text/css"><!--td {border: 1px solid #ccc;}br {mso-data-placement:same-cell;}--></style>
Session 1: Sunday July 1st – Friday July 6th, Session 2: Sunday July 8th – Friday July 13th, Session 3: Sunday July 15th – Friday July 20th, Session 4: Sunday July 22nd– Friday July 27th
Session 1: Sunday July 1st – Friday July 6th, Session 2: Sunday July 8th – Friday July 13th, Session 3: Sunday July 15th – Friday July 20th, Session 4: Sunday July 22nd– Friday July 27th
Session 1: Sunday July 1st – Friday July 6th, Session 2: Sunday July 8th – Friday July 13th, Session 3: Sunday July 15th – Friday July 20th, Session 4: Sunday July 22nd– Friday July 27th
Session 3: Sunday July 15th – Friday July 20th, Session 4: Sunday July 22nd– Friday July 27th

<colgroup><col width="237"></colgroup><tbody>
</tbody>
This is how they look. The cell to the right should show 1,2,3,4 or 3,4.
 
Upvote 0
Will this do?
(Not comma separated)

=TRIM(IF(ISNUMBER(SEARCH("Session 1",A1)),"1 ","")&IF(ISNUMBER(SEARCH("Session 2",A1)),"2 ","")&IF(ISNUMBER(SEARCH("Session 3",A1)),"3 ","")&IF(ISNUMBER(SEARCH("Session 4",A1)),"4 ",""))
 
Upvote 0
This should all be in one cell.
There can be 4 sessions Max.

Hi, welcome to the forum!

Here is just another option that you can try.


Excel 2013/2016
AB
1Session 1: Sunday July 1st Friday July 6th, Session 2: Sunday July 8th Friday July 13th, Session 3: Sunday July 15th Friday July 20th, Session 4: Sunday July 22nd Friday July 27th1,2,3,4
2Session 1: Sunday July 1st Friday July 6th, Session 2: Sunday July 8th Friday July 13th, Session 3: Sunday July 15th Friday July 20th, Session 4: Sunday July 22nd Friday July 27th1,2,3,4
3Session 1: Sunday July 1st Friday July 6th, Session 2: Sunday July 8th Friday July 13th, Session 3: Sunday July 15th Friday July 20th, Session 4: Sunday July 22nd Friday July 27th1,2,3,4
4Session 3: Sunday July 15th Friday July 20th, Session 4: Sunday July 22nd Friday July 27th3,4
5Session 1: Sunday July 15th Friday July 20th, Session 4: Sunday July 22nd Friday July 27th1,4
6Session 4: Sunday July 15th Friday July 20th4
Sheet1
Cell Formulas
RangeFormula
B1=SUBSTITUTE(TRIM(SUBSTITUTE(SUMPRODUCT(0+ISNUMBER(SEARCH("Session "&{1,2,3,4}&":",A1)),{1000000,20000,300,4}),0," "))," ",",")
 
Last edited:
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,254
Members
448,556
Latest member
peterhess2002

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