#1   Report Post  
gregork
 
Posts: n/a
Default 2 DIGITS OUT OF 4

From a four digit number I want to have a formula that extracts only the
middle two numbers eg." 5062" would equal "06" or "4113" would equal "11".

GK


  #2   Report Post  
Ken Wright
 
Posts: n/a
Default

=--MID(A1,2,2)

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------

"gregork" wrote in message
...
From a four digit number I want to have a formula that extracts only the
middle two numbers eg." 5062" would equal "06" or "4113" would equal "11".

GK




  #3   Report Post  
Michael Bednarek
 
Posts: n/a
Default

On Sun, 20 Feb 2005 04:23:12 +1300, "gregork"
wrote in microsoft.public.excel.misc:

From a four digit number I want to have a formula that extracts only the
middle two numbers eg." 5062" would equal "06" or "4113" would equal "11".


Perhaps I'm missing something, but doesn't
=MID(A1,2,2)
do that?

--
Michael Bednarek http://mbednarek.com/ "POST NO BILLS"
  #4   Report Post  
Ken Wright
 
Posts: n/a
Default

The -- bit assumed you wanted numbers as stated, though you wouldn't get 06
which you also stated. If you really want a string returned then just skip
the -- bit.

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------

"Ken Wright" wrote in message
...
=--MID(A1,2,2)

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

--------------------------------------------------------------------------

--
It's easier to beg forgiveness than ask permission :-)
--------------------------------------------------------------------------

--

"gregork" wrote in message
...
From a four digit number I want to have a formula that extracts only the
middle two numbers eg." 5062" would equal "06" or "4113" would equal

"11".

GK






  #5   Report Post  
Harald Staff
 
Posts: n/a
Default

MID is a text function, so just for the fun of it a pure numeric approach
too:

=INT(MOD(A1,1000)/10)

Best wishes Harald


"gregork" skrev i melding
...
From a four digit number I want to have a formula that extracts only the
middle two numbers eg." 5062" would equal "06" or "4113" would equal "11".

GK






  #6   Report Post  
gregork
 
Posts: n/a
Default

Thanks for all the replies...they all do what I wanted cheers.

GK

"Harald Staff" wrote in message
...
MID is a text function, so just for the fun of it a pure numeric approach
too:

=INT(MOD(A1,1000)/10)

Best wishes Harald


"gregork" skrev i melding
...
From a four digit number I want to have a formula that extracts only the
middle two numbers eg." 5062" would equal "06" or "4113" would equal

"11".

GK






  #7   Report Post  
Michael Bednarek
 
Posts: n/a
Default

On Sat, 19 Feb 2005 22:50:27 +0100, "Harald Staff"
wrote in microsoft.public.excel.misc:

MID is a text function, so just for the fun of it a pure numeric approach
too:

=INT(MOD(A1,1000)/10)


That MID() is a text function doesn't seem to matter - TEXT() seems
implied. To wit: =MID(5062,2,2) gives 06 which is what the OP wanted.

Your function omits the leading zero.

"gregork" skrev i melding
...
From a four digit number I want to have a formula that extracts only the
middle two numbers eg." 5062" would equal "06" or "4113" would equal "11".


--
Michael Bednarek http://mbednarek.com/ "POST NO BILLS"
  #8   Report Post  
Harald Staff
 
Posts: n/a
Default

"Michael Bednarek" skrev i melding
...

That MID() is a text function doesn't seem to matter - TEXT() seems
implied. To wit: =MID(5062,2,2) gives 06 which is what the OP wanted.


Relax man. Solutions posted here are also archived and used by readers which
may have slightly different needs, so alternate approaches to a problem is
always good and nothing to get worked up about. I know your solution works
fine and that it probably solved the initial problem. Just wanted to say
that a text approach to number material is not the only way to go. Text
functions are e.g. nothing but trouble when we calculate date and time..

Your function omits the leading zero.


As we both know, 6 and 06 is the same number. Custom number format 00 will
display one digit integers with a leading zero.

Best wishes Harald


  #9   Report Post  
Ken Wright
 
Posts: n/a
Default

The OP:-
extracts only the middle two numbers

^^^^^^
Harald:-
MID is a text function, so just for the fun of it a pure numeric approach
too:


As I pointed out, the original question was not succinct wrt exactly what
was to be returned, and besides that it was Saturday and Harald was bored.
:-)

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------

"Michael Bednarek" wrote in message
...
On Sat, 19 Feb 2005 22:50:27 +0100, "Harald Staff"
wrote in microsoft.public.excel.misc:

MID is a text function, so just for the fun of it a pure numeric approach
too:

=INT(MOD(A1,1000)/10)


That MID() is a text function doesn't seem to matter - TEXT() seems
implied. To wit: =MID(5062,2,2) gives 06 which is what the OP wanted.

Your function omits the leading zero.

"gregork" skrev i melding
...
From a four digit number I want to have a formula that extracts only

the
middle two numbers eg." 5062" would equal "06" or "4113" would equal

"11".

--
Michael Bednarek http://mbednarek.com/ "POST NO BILLS"



  #10   Report Post  
Jack Sons
 
Posts: n/a
Default

Harald,

... Solutions posted here are also archived and used by readers which
may have slightly different needs


Yes, Over the years I did so 712 times! Learned a lot of all those posts and
answers and even could sometimes help somebody else with an item out of my
archive.

So please keep on doing the right thing, guys like me (not clever enough to
invent all those solutions myself, sometimes even not understanding them
fully) are grateful for it.

Jack Sons
The netherlands


"Harald Staff" schreef in bericht
...
"Michael Bednarek" skrev i melding
...

That MID() is a text function doesn't seem to matter - TEXT() seems
implied. To wit: =MID(5062,2,2) gives 06 which is what the OP wanted.


Relax man. Solutions posted here are also archived and used by readers
which
may have slightly different needs, so alternate approaches to a problem is
always good and nothing to get worked up about. I know your solution works
fine and that it probably solved the initial problem. Just wanted to say
that a text approach to number material is not the only way to go. Text
functions are e.g. nothing but trouble when we calculate date and time..

Your function omits the leading zero.


As we both know, 6 and 06 is the same number. Custom number format 00 will
display one digit integers with a leading zero.

Best wishes Harald




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sort by last 2 digits mbparks Excel Worksheet Functions 4 February 17th 05 06:11 PM
15 digits??? muckali Excel Discussion (Misc queries) 1 February 15th 05 05:21 AM
Least number of digits in Y-axis labels Charley Kyd Charts and Charting in Excel 9 February 6th 05 03:03 PM
How do I format cells to a specific number of digits? Gabriele Excel Discussion (Misc queries) 3 February 5th 05 03:17 PM
Using a IF formula, I would like to drop the 2 digits in front of. osuhoosier Excel Discussion (Misc queries) 2 January 6th 05 08:21 PM


All times are GMT +1. The time now is 12:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"