Extracting data from a description

BigGee

New Member
Joined
Sep 8, 2020
Messages
31
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hello,
I am trying to extract 2 parts from a text field into separate columns. I have been trying to use the MID function and even though I have had it work in a previous similar instance I am having difficulty I think because of the fact that my model can have a different number of characters
Could someone assist please?
1720706449143.png
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Can you show us your expected results?
Also, are you using 365 or 2019 to do this?
365 has some really cool new text functions that may make this a bit easier.
 
Upvote 0
Hello Joe
I am using 365
I want eventually to show in column B B2 "JUBILEE-1" B3 "SPECIAL-5" and B4 "CARNIVAL-10" and
in column C C2 "RED-XL" C3 "BLUE-M" C4 "GREEN-L"

In an ideal world I would like to also know how to have the Colour and the size eg. Green and L (for large) separate.
 
Upvote 0
I have been able to this using TEXTSPLIT function following Joe's suggestion.
Would still like to know if there is a different/better way though :)
Especially as I have found that some cells have a space in that then messes it all up.

1720707915189.png
 
Last edited:
Upvote 0
I have been able to this using TEXTSPLIT function follwoing Joe's suggestion.
Would still like to know if there is a different/better way though :)
Are you saying you got it working now?
TEXTSPLIT is, most likely, the preferred/best way of doing it.
Is there some reason you think otherwise?

If you post the formulas you used, we will see if there may be a way to shorten them (if you have made them more complicated than they need to be).
 
Upvote 0
Hi Joe,
Yes I used the TEXTSPLIT function - however where there is a "difference" in the format (per my edit to my last message) it throws the columns out.

1720708390013.png



in this instance I would liked the PRESENT-5 and SPECIAL into column E and G5 and H5 to be in F5 and G5 respectively as the previous rows.

I used =mid (a2,find("-",A2)-1,99) originally but I couldn't get it to work to show the whole of the model number because of the difference in the number of characters in the Model
 
Upvote 0
Like this?
1720709310956.png


Here is the formulas I used:

B2:
Excel Formula:
=TEXTBEFORE(A2," ",LEN(A2)-LEN(SUBSTITUTE(A2," ",""))-1)

C2:
Excel Formula:
=TEXTBEFORE(TRIM(TEXTAFTER(A2,B2))," ",1)

D2:
Excel Formula:
=TRIM(TEXTAFTER(A2,C2,1))
 
Upvote 0
One more option:
Book1
ABCDE
1
2JUB-1 15X15 RED-XLJUB-115X15REDXL
3SPECS-5 10X15 BLUE-MSPECS-510X15BLUEM
4CARNIVIAL-10 15X15 GREEN-LCARNIVIAL-1015X15GREENL
5PRSENT-5 SPECIAL 20X12 YELLOW-SPRSENT-5 SPECIAL20X12YELLOWS
Sheet5
Cell Formulas
RangeFormula
B2:B5B2=TEXTBEFORE(A2," ",-2)
C2:E5C2=TEXTSPLIT(TEXTAFTER(A2," ",-2),{" ","-"})
Dynamic array formulas.
 
Upvote 0
Thank you Joe, you have been so helpful.
I am sorry to be a pain but I have run into another issue in that I have found some occassions (only some) where there is an EXTRA variant on the end.
This throws everything out further back in the process.
Is there a way to amend the formula so it just trims forward each time?

Below hopefully shows my issue

1720710770123.png
 
Upvote 0
I have a feeling this may not be the last of the exceptions.
Before we go any further, we need you to:

1. First identify ALL possible structures to these values
2. Explain (in plain English) the "rules" for knowing exactly where to split each value
 
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

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