how to extract relevant part of a string

bigdan

Well-known Member
Joined
Oct 5, 2009
Messages
843
Office Version
  1. 2013
Platform
  1. Windows
I've got an Excel file which details the size of various folders.

The problem is right now the file says things like "28.2 MB", 75,913.4 MB" etc.

I'd like to extract just the numbers, so that I can then do a sum on them. What's the exact formula to do this? I'm guessing it's a FIND nested within a LEFT but I cant quite figure it out.

EDIT - I tried this formula "=LEFT(B23,FIND("MB",B23)-2)" but although it gave me the results I wanted, ie what looked like numbers, I cant add them up. Can someone advise?
 
Last edited:

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
How about
=LEFT(A1,LEN(A1)-3)
This assumes all values end with spaceMB
 
Upvote 0
EDIT - I tried this formula "=LEFT(B23,FIND("MB",B23)-2)" but although it gave me the results I wanted, ie what looked like numbers, I cant add them up. Can someone advise?
The result of a text function call is text, even if that text looks like a number. The way to convert it to a real number is to involve it in a mathematical operation that won't change the number (add zero, multiply by plus 1, put a double minus sign (--) in front of it (which is the equivalent of multiplying by minus one twice). So, for your formula...

=0+LEFT(B23,FIND("MB",B23)-2)
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,215,577
Messages
6,125,637
Members
449,242
Latest member
Mari_mariou

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