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
 
Not sure what you want with the trailing words like "CLEAR", but try:
Book1
ABCDE
1
2JUB-1 15X15 RED-XLJUB-115X15RED-XL
3SPECS-5 10X15 BLUE-MSPECS-510X15BLUE-M
4CARNIVIAL-10 15X15 GREEN-LCARNIVIAL-1015X15GREEN-L
5PRSENT-5 SPECIAL 20X12 YELLOW-SPRSENT-5 SPECIAL20X12YELLOW-S
6FAIR-11 5X5 BLUE-S CLEARFAIR-115X5BLUE-SCLEAR
7PRSENT-5 SPECIAL 20X12 YELLOW-S CLEARPRSENT-5 SPECIAL20X12YELLOW-SCLEAR
Sheet5
Cell Formulas
RangeFormula
B6:E7,B2:D5B2=LET(tb,TEXTBEFORE(LEFT(A2,SEARCH("?X?",A2))," ",-1),tx,TEXTSPLIT(TEXTAFTER(A2,tb)," ",,1),HSTACK(tb,tx))
Dynamic array formulas.
 
Upvote 0

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Some adjustments to formula. It wouldn't have worked if you had X in the model part.
Book1
ABCDE
1
2JUB-1 15X15 RED-XLJUB-115X15RED-XL
3SPECS-5 10X15 BLUE-MSPECS-510X15BLUE-M
4CARNIVIAL-10 15X15 GREEN-LCARNIVIAL-1015X15GREEN-L
5PRSENT-5 SPECIAL 20X12 YELLOW-SPRSENT-5 SPECIAL20X12YELLOW-S
6FAIR-11 5X5 BLUE-S CLEARFAIR-115X5BLUE-SCLEAR
7PRSENT-5 SPECIAL 20X12 YELLOW-S CLEARPRSENT-5 SPECIAL20X12YELLOW-SCLEAR
8PXSENT-5 SPECIAL 20X12 YELLOW-S CLEARPXSENT-5 SPECIAL20X12YELLOW-SCLEAR
Sheet5
Cell Formulas
RangeFormula
B6:E8,B2:D5B2=LET(x,SEARCH({" ?X? "," ??X?? "},A2),tb,TEXTBEFORE(LEFT(A2,MAX(IFERROR(x,0)))," ",-1),tx,TEXTSPLIT(TEXTAFTER(A2,tb)," ",,1),HSTACK(tb,tx))
Dynamic array formulas.
 
Upvote 0
Solution
Hi Joe,

I have checked back through the last 3 years of data and the last line reflects the most complex string that needs to be split and the 5 lines represent all of the variables.
 
Upvote 0
Some adjustments to formula. It wouldn't have worked if you had X in the model part.
Book1
ABCDE
1
2JUB-1 15X15 RED-XLJUB-115X15RED-XL
3SPECS-5 10X15 BLUE-MSPECS-510X15BLUE-M
4CARNIVIAL-10 15X15 GREEN-LCARNIVIAL-1015X15GREEN-L
5PRSENT-5 SPECIAL 20X12 YELLOW-SPRSENT-5 SPECIAL20X12YELLOW-S
6FAIR-11 5X5 BLUE-S CLEARFAIR-115X5BLUE-SCLEAR
7PRSENT-5 SPECIAL 20X12 YELLOW-S CLEARPRSENT-5 SPECIAL20X12YELLOW-SCLEAR
8PXSENT-5 SPECIAL 20X12 YELLOW-S CLEARPXSENT-5 SPECIAL20X12YELLOW-SCLEAR
Sheet5
Cell Formulas
RangeFormula
B6:E8,B2:D5B2=LET(x,SEARCH({" ?X? "," ??X?? "},A2),tb,TEXTBEFORE(LEFT(A2,MAX(IFERROR(x,0)))," ",-1),tx,TEXTSPLIT(TEXTAFTER(A2,tb)," ",,1),HSTACK(tb,tx))
Dynamic array formulas.
Works perfectly, just wish understood it. Thank you!
 
Upvote 0
Works perfectly, just wish understood it. Thank you!
You're welcome. You can split the color and the size with another small change. :)
Book1
ABCDEF
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
6FAIR-11 5X5 BLUE-S CLEARFAIR-115X5BLUESCLEAR
7PRSENT-5 SPECIAL 20X12 YELLOW-S CLEARPRSENT-5 SPECIAL20X12YELLOWSCLEAR
8PXSENT-5 SPECIAL 20X12 YELLOW-S CLEXRPXSENT-5 SPECIAL20X12YELLOWSCLEXR
Sheet5
Cell Formulas
RangeFormula
B6:F8,B2:E5B2=LET(x,SEARCH({" ?X? "," ??X?? "},A2), tb,TEXTBEFORE(LEFT(A2,MAX(IFERROR(x,0)))," ",-1), tx,TEXTSPLIT(TEXTAFTER(A2,tb),{" ","-"},,1), HSTACK(tb,tx))
Dynamic array formulas.
 
Upvote 0
Hi Cubist,

I know I am an absolute pain, and this would be addressed by Joe's previous comment but I have found an issue where the formula breaks when the measurement eg15X15 is not a full number as shown in the example below.
Is there a solution to this?
1720768605944.png
 
Upvote 0
Try:
Book1
ABCDEF
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
6FAIR-11 5X5 BLUE-S CLEARFAIR-115X5BLUESCLEAR
7PRSENT-5 SPECIAL 20X12 YELLOW-S CLEARPRSENT-5 SPECIAL20X12YELLOWSCLEAR
8PXSENT-5 SPECIAL 20X12 YELLOW-S CLEARPXSENT-5 SPECIAL20X12YELLOWSCLEAR
9GALLERY-6 5X5'6 ORANGE-XS SUPERDUPPER_XGALLERY-65X5'6ORANGEXSSUPERDUPPER_X
Sheet4
Cell Formulas
RangeFormula
B6:F9,B2:E5B2=LET(t,TEXTSPLIT(A2,," "),x,FIND("X",t), ta,TEXTJOIN(" ",,TAKE(t,XMATCH(TRUE,MAP(t,x,LAMBDA(a,b,ISNUMBER(--CONCAT(MID(a,b+{-1,1},1))))))-1)), HSTACK(ta,TEXTSPLIT(TEXTAFTER(A2,ta),{" ","-"},,1)))
Dynamic array formulas.
 
Upvote 0
Works perfectly, just wish understood it. Thank you!
The marked solution has been changed accordingly. In your future questions, please mark the post as the solution that actually answered your question, instead of your feedback message as it will help future readers. No further action is required for this thread.
 
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