The need to use MID

JCScoobyRS

Board Regular
Joined
Sep 17, 2002
Messages
102
I have a number, 0.0045, and I need to take off the first 0. I tried this with MID but I must had done it wrong as it didn't work. Any ideas? Thanks, Jeremy
 

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

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,209
On 2002-09-30 17:06, JCScoobyRS wrote:
I have a number, 0.0045, and I need to take off the first 0. I tried this with MID but I must had done it wrong as it didn't work. Any ideas? Thanks, Jeremy

What should be the result?
 

PaddyD

MrExcel MVP
Joined
May 1, 2002
Messages
14,234
given that some messages are being lost, don;'t know if this has already been answered! but how about something of the form:

=MID(A1,FIND(".",A1),LEN(A1)-(FIND(".",A1,1))+1)

paddy

P.S. this is all BC (before coffee), so no promises about 'shortest method' etc...
This message was edited by PaddyD on 2002-09-30 17:12
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,209

ADVERTISEMENT

On 2002-09-30 17:10, JCScoobyRS wrote:
.0045

=IF(LEFT(A1)+0,A1,SUBSTITUTE(A1,LEFT(A1),"",1))

whose result will be a text-formatted number.
 

Juan Pablo González

MrExcel MVP
Joined
Feb 8, 2002
Messages
11,959

ADVERTISEMENT

On 2002-09-30 17:19, Aladin Akyurek wrote:
On 2002-09-30 17:10, JCScoobyRS wrote:
.0045

=IF(LEFT(A1)+0,A1,SUBSTITUTE(A1,LEFT(A1),"",1))

whose result will be a text-formatted number.

Aladin,

One question, why the SUBSTITUTE to replace the first occurrence of LEFT(A1), and not use RIGHT(A1,LEN(A1)-1) instead ? seems a bit strange to me... is it just a matter of style ?
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,209
On 2002-09-30 17:51, Juan Pablo G. wrote:
On 2002-09-30 17:19, Aladin Akyurek wrote:
On 2002-09-30 17:10, JCScoobyRS wrote:
.0045

=IF(LEFT(A1)+0,A1,SUBSTITUTE(A1,LEFT(A1),"",1))

whose result will be a text-formatted number.

Aladin,

One question, why the SUBSTITUTE to replace the first occurrence of LEFT(A1), and not use RIGHT(A1,LEN(A1)-1) instead ? seems a bit strange to me... is it just a matter of style ?

Juan,

I did too many substitutions lately... so it's maybe a recency effect... Both

=IF(LEFT(A1,2)<>"0.",A1,SUBSTITUTE(A1,LEFT(A1),"",1))

and

=IF(LEFT(A1,2)<>"0.",A1,RIGHT(A1,LEN(A1)-1))

would do.

The initial formula has, although good enough, a terse condition, hence expanded here...

BTW, why is SUBSTITUTE strange?
 

Juan Pablo González

MrExcel MVP
Joined
Feb 8, 2002
Messages
11,959
On 2002-10-01 02:34, Aladin Akyurek wrote:
Juan,

I did too many substitutions lately... so it's maybe a recency effect... Both

=IF(LEFT(A1,2)<>"0.",A1,SUBSTITUTE(A1,LEFT(A1),"",1))

and

=IF(LEFT(A1,2)<>"0.",A1,RIGHT(A1,LEN(A1)-1))

would do.

The initial formula has, although good enough, a terse condition, hence expanded here...

BTW, why is SUBSTITUTE strange?

Why strange ? well, I don't know seemed like an unusual path for replacing a (one) character string with "", that's it...
 

Forum statistics

Threads
1,143,617
Messages
5,719,735
Members
422,242
Latest member
hishamkhatri

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
Top