ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   HOW DO I CONVERT A NUMBER'S MOST SIGNIFICANT DIGIT TO A SINGLE DI. (https://www.excelbanter.com/excel-worksheet-functions/180999-how-do-i-convert-numbers-most-significant-digit-single-di.html)

maxq777

HOW DO I CONVERT A NUMBER'S MOST SIGNIFICANT DIGIT TO A SINGLE DI.
 
I am trying to work a problem for a random number generator. Essentially,
the random number is being generated by using two random number generators (X
= 1 to 100 and Y = 1 to 100) and then dividing X by Y to get a seed for the
random nujber.

I need to take the most significant digit of the number and convert it to an
integer between 1 and 9.

Any idea as to how I can do this?

Tyro[_2_]

HOW DO I CONVERT A NUMBER'S MOST SIGNIFICANT DIGIT TO A SINGLE DI.
 
First stop using capitals, as it is considered yelling.

Tyro

"maxq777" wrote in message
...
I am trying to work a problem for a random number generator. Essentially,
the random number is being generated by using two random number generators
(X
= 1 to 100 and Y = 1 to 100) and then dividing X by Y to get a seed for
the
random nujber.

I need to take the most significant digit of the number and convert it to
an
integer between 1 and 9.

Any idea as to how I can do this?




Ron Rosenfeld

HOW DO I CONVERT A NUMBER'S MOST SIGNIFICANT DIGIT TO A SINGLE DI.
 
On Sat, 22 Mar 2008 18:53:01 -0700, maxq777
wrote:

I am trying to work a problem for a random number generator. Essentially,
the random number is being generated by using two random number generators (X
= 1 to 100 and Y = 1 to 100) and then dividing X by Y to get a seed for the
random nujber.

I need to take the most significant digit of the number and convert it to an
integer between 1 and 9.

Any idea as to how I can do this?



I believe:

=--MID(A1,MIN(SEARCH({1,2,3,4,5,6,7,8,9},A1&"12345678 9")),1)

will return the most significant digit as an integer.
--ron

Rick Rothstein \(MVP - VB\)[_231_]

HOW DO I CONVERT A NUMBER'S MOST SIGNIFICANT DIGIT TO A SINGLE DI.
 
Just out of curiosity, in which random number function are you using this
"seed" value?

Rick


"maxq777" wrote in message
...
I am trying to work a problem for a random number generator. Essentially,
the random number is being generated by using two random number generators
(X
= 1 to 100 and Y = 1 to 100) and then dividing X by Y to get a seed for
the
random nujber.

I need to take the most significant digit of the number and convert it to
an
integer between 1 and 9.

Any idea as to how I can do this?



Bernd P

HOW DO I CONVERT A NUMBER'S MOST SIGNIFICANT DIGIT TO A SINGLEDI.
 
Hello,

Another solution might be
=--LEFT(TEXT(ABS(A1),"0.000000000000000E+0"),1)

Regards,
Bernd


All times are GMT +1. The time now is 11:55 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com