Formula to find 2nd number in a cell

j8mie

New Member
Joined
Aug 23, 2011
Messages
4
Hope someone might be able to help me with a formula that's been doing my head in for a few of days now.

Basically I would like to split the contents of a cell into separate parts without using Text to Columns.

The data is always in the following format, word, space, number (0-9), hyphen, number (0-9), space, word

eg
Castle 5-7 Fort
Temple 1-0 House
Cathedral 0-4 Church

I've had no problems getting the first word, first number and last word into new cells. But it's that second number after the hyphen which seems to be impossible to get into a cell on it's own.

Can anyone help?
 
Thank you once again. Both of those formulas do the job perfectly.

This site has proved very useful in such a short space of time. Thank you for taking the time to help me out.
Glad to help out and thanks for the feedback.

When you say that both formulas "do the job perfectly", I'm not sure if you meant all four formulas suggested by Ingolf and me or just what your requirements are, but note that our formulas do not all produce the same result.

It may not matter to you, but Ingolf's formula for the left word(s) leaves a space on the end so for example your get "Castle " not "Castle". If you are certain that there is only ever one (and not multiple) space between the first word(s) and the first number then you could just use
=LEFT(A2,FIND("-",A2)-3)
I used TRIM instead since it caters for the case where there may be 2 or more spaces between the word(s) and the number.

If there is only one space between the second number and the final words then our formulas produce the same result. If there happened to be more than one space a similar issue would arise.
 
Upvote 0

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,224,618
Messages
6,179,919
Members
452,949
Latest member
beartooth91

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