Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Tom Tom is offline
external usenet poster
 
Posts: 2
Default Find first digit of value

I have a large vector of values with a wide dynamic range (10^-6 to 10^-
16). For a particular application, I need to retrieve only the first
digits of the values, yielding an output vector that contains only the
values 1 through 9. I can do this manually fairly easily by first
multiplying by an appropriate value to bring the result to a whole number,
then truncating the fractional part.

I'm sure that there must be a way to automate this in Excel, but I can't
figure out how to do it. The problem seems to lie in my inability to
separate the characteristic and mantissa.

Any ideas?


--Tom
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default Find first digit of value

On Tue, 13 Nov 2007 17:40:04 +0000 (UTC), Tom wrote:

I have a large vector of values with a wide dynamic range (10^-6 to 10^-
16). For a particular application, I need to retrieve only the first
digits of the values, yielding an output vector that contains only the
values 1 through 9. I can do this manually fairly easily by first
multiplying by an appropriate value to bring the result to a whole number,
then truncating the fractional part.

I'm sure that there must be a way to automate this in Excel, but I can't
figure out how to do it. The problem seems to lie in my inability to
separate the characteristic and mantissa.

Any ideas?


--Tom


=LEFT(TEXT(A1,"0.000000000000000E+0"),1)

Note that if in the TEXT function, you have fewer digits in the decimal
portion, some values may be rounded up in the first digit.
--ron
  #3   Report Post  
Posted to microsoft.public.excel.misc
Tom Tom is offline
external usenet poster
 
Posts: 2
Default Find first digit of value

Ron Rosenfeld wrote in
:

On Tue, 13 Nov 2007 17:40:04 +0000 (UTC), Tom
wrote:

I have a large vector of values with a wide dynamic range (10^-6 to
10^- 16). For a particular application, I need to retrieve only the
first digits of the values, yielding an output vector that contains
only the values 1 through 9. I can do this manually fairly easily by
first multiplying by an appropriate value to bring the result to a
whole number, then truncating the fractional part.

I'm sure that there must be a way to automate this in Excel, but I
can't figure out how to do it. The problem seems to lie in my
inability to separate the characteristic and mantissa.

Any ideas?


--Tom


=LEFT(TEXT(A1,"0.000000000000000E+0"),1)

Note that if in the TEXT function, you have fewer digits in the
decimal portion, some values may be rounded up in the first digit.
--ron


Thanks. I assume that, since I have 2-digit exponents, I ned to end it
with "...E+00", rather than a single zero.


Regards,

Tom

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default Find first digit of value

On Thu, 15 Nov 2007 20:49:56 +0000 (UTC), Tom wrote:

Ron Rosenfeld wrote in
:

On Tue, 13 Nov 2007 17:40:04 +0000 (UTC), Tom
wrote:

I have a large vector of values with a wide dynamic range (10^-6 to
10^- 16). For a particular application, I need to retrieve only the
first digits of the values, yielding an output vector that contains
only the values 1 through 9. I can do this manually fairly easily by
first multiplying by an appropriate value to bring the result to a
whole number, then truncating the fractional part.

I'm sure that there must be a way to automate this in Excel, but I
can't figure out how to do it. The problem seems to lie in my
inability to separate the characteristic and mantissa.

Any ideas?


--Tom


=LEFT(TEXT(A1,"0.000000000000000E+0"),1)

Note that if in the TEXT function, you have fewer digits in the
decimal portion, some values may be rounded up in the first digit.
--ron


Thanks. I assume that, since I have 2-digit exponents, I ned to end it
with "...E+00", rather than a single zero.


Regards,

Tom


Since you are just looking for the first digit, I don't think that makes any
difference.

--ron
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
Find duplicate entries that have trailing digit that may change. DENNIS SHEROW Excel Discussion (Misc queries) 1 September 3rd 07 12:16 AM
How or where do I find my 25 digit license number teacher version Barbara New Users to Excel 4 December 5th 06 07:53 PM
find the value of the last digit in a cell Thruway Excel Worksheet Functions 2 December 20th 05 05:40 PM
How to find if a string starts with a digit galsaba Excel Worksheet Functions 1 March 4th 05 06:01 PM
When we enter a 16 digit number (credit card) the last digit chan. ceking Excel Discussion (Misc queries) 5 December 8th 04 11:45 PM


All times are GMT +1. The time now is 08:30 PM.

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

About Us

"It's about Microsoft Excel"