Formula to extract variable substring from string with multiple spaces

Royzer

New Member
Joined
Jun 22, 2010
Messages
48
Hi.

I've found several posts about returning variable substrings that dealt with one or two spaces, but I have not been able to find anything that is for multiple spaces. The number of characters before the substring will remain constant.

For example:

Income from transmission agreement - 83 subs @ $0.44

In this case I need to extract: 83

Income from transmission agreement - 10,312 subs @ $0.50

Need: 10,312


I would really appreciate any help you can give me.

Thanks!
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Give this formula a try...

=LOOKUP(9.9E+307,--LEFT(TRIM(MID(A2,FIND("-",A2&"-")+1,LEN(A2))),ROW(INDIRECT("1:"&LEN(A2)))))
 
Last edited:
Upvote 0
Hi,

Perhaps try:
Excel Workbook
AB
1Income from transmission agreement - 83 subs @ $0.4483
2Income from transmission agreement - 10,312 subs @ $0.5010312
Sheet1
Excel 2010
Cell Formulas
RangeFormula
B1=--MID(A1,38,FIND(" ",A1,38)-38)
 
Upvote 0
Try... with some hardcoded elements:

Code:
=MID(B1,38,FIND("subs",B1,38)-39)
 
Upvote 0
Hi,

Perhaps try:

Sheet1
AB
1Income from transmission agreement - 83 subs @ $0.4483
2Income from transmission agreement - 10,312 subs @ $0.5010312

<THEAD>
</THEAD><TBODY>
</TBODY>
Excel 2010

Worksheet Formulas
CellFormula
B1=--MID(A1,38,FIND(" ",A1,38)-38)

<THEAD>
</THEAD><TBODY>
</TBODY>

<TBODY>
</TBODY>


circledchicken:

This one also works when changed to position "40".

=MID(A1,40,FIND(" ",A1,40)-40)



Thanks to you all!
 
Upvote 0
circledchicken:

This one also works when changed to position "40".

=MID(A1,40,FIND(" ",A1,40)-40)



Thanks to you all!
I assume there are two extra spaces somewhere in the sentence, perhaps at the start? By the way the double minus (--) at the start of the formula converts a string (which is returned by the MID function in this case) to an actual number.

Anyway, great - I'm glad you got it working!
 
Upvote 0
circledchicken: "By the way the double minus (--) at the start of the formula converts a string (which is returned by the MID function in this case) to an actual number."

I did not know that! Thanks! :)
 
Upvote 0

Forum statistics

Threads
1,213,539
Messages
6,114,221
Members
448,554
Latest member
Gleisner2

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