Splitting Text String into multiple Cells

mummbles74

Board Regular
Joined
Nov 14, 2009
Messages
120
Office Version
  1. 365
Platform
  1. Windows
I have a text string that is a consistent format seperated by - I would like to split the text into 5 different column into the different elements. Assuming the main string is in C1 I would like the data split across the same row in column D:G An example of the text string is as follows: WARRN-SL1-ST1-PDI01-MI001

As an addition would their be a way to send an error if the string did not meet this format?
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Maybe:
Excel Formula:
=LET(d,TEXTSPLIT(C1,"-",,TRUE),IF(COUNTA(d)<5,"Error",d))

But this depends on how one views:
As an addition would their be a way to send an error if the string did not meet this format?

Currently the check it does is make sure there ar 5 parts to the string

Book1
ABCDEFGH
1WARRN-SL1-ST1-PDI01-MI001WARRNSL1ST1PDI01MI001
2123Error
3WARRN-SL1-ST1-PDI01Error
Sheet1
Cell Formulas
RangeFormula
D1:H1,D2:D3D1=LET(d,TEXTSPLIT(C1,"-",,TRUE),IF(COUNTA(d)<5,"Error",d))
Dynamic array formulas.
 
Upvote 0
Solution

Forum statistics

Threads
1,215,130
Messages
6,123,220
Members
449,091
Latest member
jeremy_bp001

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