Parse text with different variables

Calicarrie

New Member
Joined
Nov 29, 2004
Messages
22
I am trying to parse some text values into 2 cells based on the "Name" and the "Size". Examples include:

PORT750ml/4pk
CHARDONNAY3L/o
WINE1.5L

Which would read as (separate cells):
PORT 750ml/4pk
CHARDONNAY 3L/o
WINE 1.5L

Since the "size" is variable and the "name" is not of consistent length, I am not sure how to automate this (preferably without a macro). I tried a "Left" function with "find" but the find function cannot include wildcards and the size is not standard.

Any ideas would be greatly appreciated!

Thanks!
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
I've been trying to figure this out, but I am stuck :mad:

I tried this;
=MID(A1,1,(FIND(OR(0,1,2,3,4,5,6,7,8,9),A1,1))-1)

Didn't work!

But this works:
=MID(A1,1,(FIND(3,A1,1))-1)
CHARDONNAY3L/o ---> CHARDONNAY

and:
=RIGHT(A1,LEN(A1)-(FIND(3,A1,1))+1)
CHARDONNAY3L/o ---> 3L/o




I need to know how to say, " Find any of the following values and return their position within the string"!!!!!!!!!!!!!!!!! Find({0,1,2,3,4,5,6,7,8,9}), i tried using this but I can't get it to work either.
 
Last edited:
Upvote 0
HOTPEPPER:

Can you explain the Replace function you used?

I don't quite grasp the part after the MIN(Find(..............), especially the concatenated value.
 
Upvote 0
This is going to create an array of every position it finds a number in the string. The concatenation is to ensure that it finds every number, so as to not get #VALUE!
Min is used so that the lowest position that a number is found (the first position) is the position -1 that we are going to replace with nothing.

So starting at the 1st character to the point it found the first number -1, it will replace with nothing. This gives us the second part.

The first part is just a basic LEFT formula that utilizes the length of the second part.
 
Last edited:
Upvote 0
This is going to create an array of every position it finds a number in the string. The concatenation is to ensure that it finds every number, so as to not get #N/A

Min is used so that the lowest position that a number is found (the first position) is the position -1 that we are going to replace with nothing.

So starting at the 1st character to the point it found the first number -1, it will replace with nothing. This gives us the second part.

The first part is just a basic LEFT formula that utilizes the length of the second part.

I see the logic of this, and it is very clever---I wouldn't have ever thought to concatenate all numbers to avoid the #N/A;

Does this mean that FIND({0,1,2,3,4,5,6,7,8,9}) searches for matches for this entire list and if even one number is not present, it will return an error? (for instance if you leave off the number 9 in the concatenation)

From this workaround, I am to believe that there is no direct way to say, "Search/Find the first position of any of the following values within a string"?
 
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,850
Members
452,948
Latest member
UsmanAli786

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