Need help on copying Multiple words in a cell based on number of characters or starts with.

vinoanbu

New Member
Joined
Oct 19, 2016
Messages
44
Office Version
  1. 365
Platform
  1. Windows
Hi,

I need a VBA code for following requirement
I'm Working in an excel report in which the range column "B" have instructions with multiple part numbers.
I need to copy only those part numbers from column "B" to the next columns C,D,E,F etc., (refer below table)
regarding the part number it always starts with 12AB and it has 14 characters only.

ABCDEFG
1Install DVR (12AB_46A_386CD) to the IO side and fix the CON (12AB_20A_124AC) towards the PWR unit. Hold TERM (12AB_10C_026DC)12AB_46A_386CD12AB_20A_124AC12AB_10C_026DC
2Fix PWR UNIT (12AB_90Q_096CD) and check I/O PIN (12AB_40D_006AC)12AB_90Q_096CD12AB_40D_006AC

Thanks,
Vino
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
If you are not against a formula:

Excel Formula:
=IFNA(DROP(REDUCE("",A1:A2,LAMBDA(a,b,VSTACK(a,
LET(
split,TEXTSPLIT(b,{" ","(",")"}),
string,LEFT(split,4)="12AB",
FILTER(split,string=TRUE))))),1),"")
 
Upvote 0
If you are not against a formula:

Excel Formula:
=IFNA(DROP(REDUCE("",A1:A2,LAMBDA(a,b,VSTACK(a,
LET(
split,TEXTSPLIT(b,{" ","(",")"}),
string,LEFT(split,4)="12AB",
FILTER(split,string=TRUE))))),1),"")

Hi, Thanks for the formula but I prefer to have a VBA code.

Thanks,
Vino
 
Upvote 0
If you are not against a formula:

Excel Formula:
=IFNA(DROP(REDUCE("",A1:A2,LAMBDA(a,b,VSTACK(a,
LET(
split,TEXTSPLIT(b,{" ","(",")"}),
string,LEFT(split,4)="12AB",
FILTER(split,string=TRUE))))),1),"")
Hi hagia,

I tried the formula, but it shows error in this part ("",A1:A2, could you check on this?

Thanks,
Vino
 
Upvote 0
Are there any blank rows within your array of interest?

Hi Hagia,

I don't see any blank rows. I captured the error and attached here for your reference.

Thanks,
Vino
 

Attachments

  • 1722333271373.png
    1722333271373.png
    45.1 KB · Views: 4
  • 1722333532619.png
    1722333532619.png
    21.4 KB · Views: 4
Upvote 0
Another formula option if the only thing in brackets are the part numbers.
Fluff.xlsm
ABCDEF
1
21Install DVR (12AB_46A_386CD) to the IO side and fix the CON (12AB_20A_124AC) towards the PWR unit. Hold TERM (12AB_10C_026DC)12AB_46A_386CD12AB_20A_124AC12AB_10C_026DC
32Fix PWR UNIT (12AB_90Q_096CD) and check I/O PIN (12AB_40D_006AC)12AB_90Q_096CD12AB_40D_006AC
Data
Cell Formulas
RangeFormula
C2:E2,C3:D3C2=TOROW(INDEX(TEXTSPLIT(B2,"(",")",1),,2))
Dynamic array formulas.


You may need to change the commas to semi-colons.
 
Upvote 0
Hi Hagia,

I don't see any blank rows. I captured the error and attached here for your reference.

Thanks,
Vino

I cannot figure out what is the problem, it does not return this message on my computer (do you have 365?); the only thing is that you should adjust the array to B1:B2 but that should not be a problem...
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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