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

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
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[TABLE="class: html-maker-worksheet"]
<THEAD>[TR]
[TH][/TH]
[TH]A[/TH]
[TH]B[/TH]
[/TR]
</THEAD><TBODY>[TR]
[TH]1[/TH]
[TD]Income from transmission agreement - 83 subs @ $0.44[/TD]
[TD="align: right"]83[/TD]
[/TR]
[TR]
[TH]2[/TH]
[TD]Income from transmission agreement - 10,312 subs @ $0.50[/TD]
[TD="align: right"]10312[/TD]
[/TR]
</TBODY>[/TABLE]
Excel 2010

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

<TBODY>
[TD="bgcolor: #ffffff"] Worksheet Formulas [TABLE="class: html-maker-worksheet"]
<THEAD>[TR]

</THEAD><TBODY>
</TBODY>
[/TD]
[/TR]
</TBODY>[/TABLE]


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,223,236
Messages
6,170,906
Members
452,366
Latest member
TePunaBloke

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