Take the fraction part out of the number

  • Thread starter Thread starter 0-0 Wai Wai ^-^
  • Start date Start date
0

0-0 Wai Wai ^-^

Hi.
I would like to extract the fraction part out of a number. For example:
1.5 -> 0.5
23.45 -> 0.45
25 -> 0

Is there any simple way to do it?
Thank you.


--
Additional information:
- I'm using Office XP
- I'm using Windows XP

¥»¤Hªº¯à¤O«D±`¦³­­. ¦p¦³¤£·í¤§³B, ±æÃѪ̤£§[½ç¥¿!!
After all, the above are merely my little opinion/idea.
Since my ability is limited, I could be wrong.
 
=MOD(A1,1)

--
Kind regards,

Niek Otten

|
|
| Hi.
| I would like to extract the fraction part out of a number. For example:
| 1.5 -> 0.5
| 23.45 -> 0.45
| 25 -> 0
|
| Is there any simple way to do it?
| Thank you.
|
|
| --
| Additional information:
| - I'm using Office XP
| - I'm using Windows XP
|
| ¥»¤Hªº¯à¤O«D±`¦³­­. ¦p¦³¤£·í¤§³B, ±æÃѪ̤£§[½ç¥¿!!
| After all, the above are merely my little opinion/idea.
| Since my ability is limited, I could be wrong.
|
|
 
=MOD(A1,1)

While this works in the Microsoft Excel worksheet function MOD for
positive values, I believe it contravenes the convention where MOD is
only defined for integer numbers. Many languages, including Microsoft's
VBA, will return 0 for any MOD(x,1).

But even Excel's function MOD(x,1) will return unexpected values for
negative numbers, as will Opinicus's solution of A1-INT(A1). Try this
instead: A1-TRUNC(A1), or -if you don't want to preserve the sign-
ABS(A1-TRUNC(A1).

Note that the Excel worksheet function MOD and the VBA operator Mod
deliver different results for negative values.

Modulo and remainder are not the same thing.
 
Frankly, I'm surprised nobody offered this solution which also works
for both positive and negative numbers:

=A1-ROUNDDOWN(A1,0)

Your collective ingenuity continues to amaze me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top