Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Specify position of decimal point in Excel

Status
Not open for further replies.

aelsn

Technical User
Dec 17, 2004
17
0
0
US
I'm not sure this is possible but I am looking for a way to specify where to place a decimal point in a number in Excel. I receive a file that contains two columns that look like this:

6 99796875
3 108237
2 9993
0 100

I want to place a decimal in the number in the second column based on the number specified in the first column. The decimal would be so many digits to the left of the end based on the value in the first column. My desired results would look like this

99.796875
108.237
99.93
100

Does anyone have an idea if this is possible and how to go about it? Thanks
 


hi,

this is simply, if your first row of data is 1 in column A
[tt]
C1: =b1/10^a1
[/tt]
and copy down

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Consider that:

99.796875 = 99796875/10^6

108.237 = 108237/10^3

99.93 = 9992/10^2

and

100 = 100/10^0
 
That worked perfectly and was very simple. Thanks again.
 
I do not believe you can change the number that is in the same column, but if we assume that a1 has the number of decimal places and b1 has the number, then the following formula should work. =IF(A1>0,VALUE(LEFT(B1,LEN(B1)-A1)&"."&RIGHT(B1,A1)),B1).

I hope this helps
 

@kray4660,

You have proposed a TEXT solution to a NUMERIC problem. Excel can and will make the implicit conversion from NUMERIC to TEXT. But it is not a particularly sound approch.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top