Extract Numbers

Celticshadow

Active Member
Joined
Aug 16, 2010
Messages
419
Office Version
  1. 365
Platform
  1. Windows
Hi All

May I ask if the board could help me out with a formula to extract the numbers and put them into columns as below.

Thanks in advance.

Kind Regards

Code:
[RANGE=cls:xl2bb-100][XR][XH=cs:4]Excel Workbook[/XH][/XR][XR][XH][/XH][XH]A[/XH][XH]B[/XH][XH]C[/XH][/XR][XR][XH]1[/XH][XD=h:c]Data[/XD][XD=h:c]Result Required[/XD][XD=h:c]Result Required[/XD][/XR][XR][XH]2[/XH][XD=h:c]11-5[/XD][XD=h:c]11[/XD][XD=h:c]5[/XD][/XR][XR][XH]3[/XH][XD=h:c]11-3[/XD][XD=h:c]11[/XD][XD=h:c]3[/XD][/XR][XR][XH]4[/XH][XD=h:c]10-12[/XD][XD=h:c]10[/XD][XD=h:c]12[/XD][/XR][XR][XH]5[/XH][XD=h:c]10-12[/XD][XD=h:c]10[/XD][XD=h:c]12[/XD][/XR][XR][XH]6[/XH][XD=h:c]10-12[/XD][XD=h:c]10[/XD][XD=h:c]12[/XD][/XR][XR][XH]7[/XH][XD=h:c]10-10[/XD][XD=h:c]10[/XD][XD=h:c]10[/XD][/XR][XR][XH]8[/XH][XD=h:c]10-10[/XD][XD=h:c]10[/XD][XD=h:c]10[/XD][/XR][XR][XH]9[/XH][XD=h:c]10-10[/XD][XD=h:c]10[/XD][XD=h:c]10[/XD][/XR][XR][XH]10[/XH][XD=h:c]10-5[/XD][XD=h:c]10[/XD][XD=h:c]5[/XD][/XR][XR][XH]11[/XH][XD=h:c]10-4[/XD][XD=h:c]10[/XD][XD=h:c]4[/XD][/XR][XR][XH]12[/XH][XD=h:c]10-0[/XD][XD=h:c]10[/XD][XD=h:c]0[/XD][/XR][XR][XH]13[/XH][XD=h:c]9-12[/XD][XD=h:c]9[/XD][XD=h:c]12[/XD][/XR][XR][XH]14[/XH][XD=h:c]9-12[/XD][XD=h:c]9[/XD][XD=h:c]12[/XD][/XR][XR][XH]15[/XH][XD=h:c]9-10[/XD][XD=h:c]9[/XD][XD=h:c]10[/XD][/XR][XR][XH]16[/XH][XD=h:c]9-7[/XD][XD=h:c]9[/XD][XD=h:c]7[/XD][/XR][XR][XH]17[/XH][XD=h:c]9-7[/XD][XD=h:c]9[/XD][XD=h:c]7[/XD][/XR][XR][XH]18[/XH][XD=h:l]I need to extract the number or numbers to left of the hyphen and place them in column B and the number to the right of the hyphen into col C.[/XD][XD][/XD][XD][/XD][/XR][XR][XH]19[/XH][XD][/XD][XD][/XD][XD][/XD][/XR][XR][XH]20[/XH][XD][/XD][XD][/XD][XD][/XD][/XR][XR][XH]21[/XH][XD][/XD][XD][/XD][XD][/XD][/XR][XR][XH]22[/XH][XD][/XD][XD][/XD][XD][/XD][/XR][XR][XH]23[/XH][XD][/XD][XD][/XD][XD][/XD][/XR][XR][XH]24[/XH][XD][/XD][XD][/XD][XD][/XD][/XR][XR][XH]25[/XH][XD][/XD][XD][/XD][XD][/XD][/XR][XR][XH=cs:4][RANGE][XR][XD]Sheet2[/XD][XH][/XH][/XR][/RANGE][/XH][/XR][/RANGE]
 
Ok, select my code.
In Excel Press ALT + F11
In the left window, double click on "This Workbook"
In the right window where the cursor is flashing, paste the code.
Save and close that window
Go back to the workbook and press ALT + F8
Select Macro1 from the dropdown list and press "Run".

Job done !
 
Upvote 0

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,224,584
Messages
6,179,693
Members
452,938
Latest member
babeneker

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