Text-to-Columns

lxd

Board Regular
Joined
Sep 15, 2010
Messages
79
The text-to-columns data parsing rule I create using the Excel macro recorder cannot handle exceptions well. For example, if the next data I parse contains a longer element or an indented element, the macro cuts that element into two parts and forces one part into the next column. I have to visually inspect and fix such errors which could be tedious.

:confused:How can I create a data parsing macro that is simply guided by space or tab, etc., separator and does not care about the length of an element or the number of columns the data could have. Is such a multi-purpose parsing macro possible? Thank you.
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
you can do text to columns based on fixed-width data or based on a delimiter. Use the latter and also check 'Treat consecutive delimiters as one' option.
 
Upvote 0
You are correct that Text-to-Columns doesn't handle exceptions well. You may have to pre-process and\or post-process your data to get it to parse the you want. Even then, depending on how "exceptional" your data is, it still may not parse 100% the way you want.

You can Pre\Post process your data using the Replace (Ctrl+H) feature or with a more sophisticated custom macro. I can't give you specifics without seeing some example data with expected results.
 
Upvote 0

Forum statistics

Threads
1,224,222
Messages
6,177,219
Members
452,765
Latest member
Erka Gizli

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