csharp_learner
asked on
adding decimals into whole number
Hi,
I am using excel 2003
how can you add a 2 decimal number into the main number?
eg. 10.15 into 10+15?
I am using excel 2003
how can you add a 2 decimal number into the main number?
eg. 10.15 into 10+15?
Or
=ROUND(A1,0)+INT(MOD(A1*10 0,100))
=ROUND(A1,0)+INT(MOD(A1*10
Hi,
If you have 10.15 in A1 then use this:
=INT(A1)+((A1-(INT(A1)))*1 00)
Alan.
If you have 10.15 in A1 then use this:
=INT(A1)+((A1-(INT(A1)))*1
Alan.
If you have 10.15 in A2 try this formula in B2
=INT(A2)+MOD(A2,1)*100
regards, barry
=INT(A2)+MOD(A2,1)*100
regards, barry
That's the best one Barry - good thinking!
Alan.
Alan.
For postering, because I messed up using ROUND instead of INT (even though it gets used in the 2nd part...)
if A1 is 10.15, and you want to get 10+15=25 as the answer..
=INT(A1)+INT(MOD(A1,1)*100 )
10.159999 will also end up as 25
if A1 is 10.15, and you want to get 10+15=25 as the answer..
=INT(A1)+INT(MOD(A1,1)*100
10.159999 will also end up as 25
Sorry, I was testing Barry's formula and got mixed up, I meant to correct my 2nd one
=INT(A1)+INT(MOD(A1*100,10 0))
=INT(A1)+INT(MOD(A1*100,10
ASKER
CAn there be a formula to do it when it is 1 decimal place?
Sorry that if i forgot to mention there are instances where it may be like
10.1 or 0.1
Sorry that if i forgot to mention there are instances where it may be like
10.1 or 0.1
So if it is 10.1 -> 11? or 20?
And can it be 10.1456 -> 10 + 1456 = 1466?
And can it be 10.1456 -> 10 + 1456 = 1466?
If your number is in A1
=IF(A1=INT(A1),A1,INT(A1)+ MID(A1,FIN D(".",A1&" .")+1,100) )
=IF(A1=INT(A1),A1,INT(A1)+
But perhaps 10.1456 = 10+14.56 = 24.56 ?
There may be a secret algorithm ;->
Alan.
There may be a secret algorithm ;->
Alan.
Variation on a theme:
=INT(A1)+SUBSTITUTE(MOD(A1 ,1),"0."," ")
=INT(A1)+SUBSTITUTE(MOD(A1
PS the above assumes your numbers are always positive.
Rory, I get
10.1 => 1E+15
10.62 => 6.2E+14
10.1 => 1E+15
10.62 => 6.2E+14
Ah, yes. Stupid bloody floating points. :)
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Or:
=INT(A1)+SUBSTITUTE(A1&".0 ",INT(A1)& ".","")
=INT(A1)+SUBSTITUTE(A1&".0
That last one is very Barry-like. Real good
csharp_learner,
As you got multiple working solutions - and before my post too - I think a points split would be fairer here.
Regards,
Rory
As you got multiple working solutions - and before my post too - I think a points split would be fairer here.
Regards,
Rory
=ROUND(A1,0)+INT((A1-ROUND