Return first 3 characters after nth comma

danhenshy23

New Member
Joined
Oct 3, 2016
Messages
38
Office Version
  1. 2019
Platform
  1. Windows
Hi,

I have a text string like the one below:

France, Germany, Mexico, Australia, Croatia

I am wanting to return the first 3 characters after the nth comma, i.e. Mex or Aus.

How can I go about this?
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Maybe:

ABCDEFG
France, Germany, Mexico, Australia, Croatia
n
FraGerMexAusCro

<tbody>
[TD="align: center"]1[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]2[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]3[/TD]

[TD="align: right"]0[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]5[/TD]

[TD="align: center"]4[/TD]
[TD="align: right"][/TD]

</tbody>
Sheet5

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<tbody>[TR="bgcolor: #DAE7F5"]
[TH]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
[TR]
[TH="bgcolor: #DAE7F5"]B4[/TH]
[TD="align: left"]=IFERROR(MID(", "&$A$1,FIND("|",SUBSTITUTE(", "&$A$1,",","|",B3+1))+2,3),"")[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:
Upvote 0
Assuming your text is less than 200 characters long, here is another formula for you to consider (replace N with the comma number, or a cell reference with the comma number in it, that you want to find the text after... use 0 for the beginning of the text)...

=LEFT(TRIM(MID(SUBSTITUTE(","&A1,",",REPT(" ",200)),(1+N)*200,200)),3)
 
Last edited:
Upvote 0
Hi,

Another way using Eric's setup:


Book1
ABCDEFG
1France, Germany, Mexico, Australia, Croatia
2
3n012345
4FraGerMexAusCro
Sheet52
Cell Formulas
RangeFormula
B4=IFERROR(MID($A1,IF(B3=0,1,FIND("^",SUBSTITUTE($A1,", ","^",B3))+2),3),"")
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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