Log in

View Full Version : quick excel help needed, and a treat very soon!


wilhil
October 16th, 2005, 07:47 PM
Hi

I am about to release a file that should help alot of you with your game and upgrades, to myknowledge there is not one like it here.

there is one thing I can not figure out, I have not been using excel in some time, anyway, how do I get rid of the decimal point and following figures in a cell but not make it round up?

I understand how to do it normally, but 1.9 will become 2, and I really need even 1.99999 to become 1, as it must be a whole number only.

can anyone help me here?

Thanks

Ed Kolis
October 16th, 2005, 07:53 PM
TRUNC chops off the decimals.
INT rounds down.
There's a subtle difference, in that -2.5 will TRUNC to -2, but INT to -3.

wilhil
October 16th, 2005, 07:59 PM
Thanks!

when you say about negative numbers, is that just for negatives, so 2.5 ints and truncs to 2, whilst 2.6 will int to 3 whilst trunc is 2?

if I get what you are saying, trunc is what I am looking for! thanks (int is not needed now, but useful to know! I have not really been going through the functions! but this is good!)

Ed Kolis
October 16th, 2005, 08:13 PM
Not quite... 2.6 would also int to 2, because int rounds *down* no matter what. But that doesn't seem to be what you need, so that doesn't matter http://forum.shrapnelgames.com/images/smilies/tongue.gif
What is this spreadsheet you're working on anyway? You said it had to do with the "game and upgrades" - do you mean modding families of components and such? If so I'd really love to see it... somehow I can't make myself use an *old* version of the templatizer, since I lost the latest version! http://forum.shrapnelgames.com/images/smilies/tongue.gif

Slick
October 16th, 2005, 08:24 PM
if you want to round in the traditional sense, add 0.5 then trunc. http://forum.shrapnelgames.com/images/smilies/happy.gif

wilhil
October 16th, 2005, 09:08 PM
here is what I was making

http://www.shrapnelcommunity.com/threads/showflat.php?Cat=&Number=388036&page=0&view=collap sed&sb=5&o=&fpart=1

I hope you enjoy, also, what is templatizer? is it something SE or general excel related?

and I dont get int then! is the only diffrence between int and trunc when you have negative numbers?

I havent done any good maths in years! and thank you trunc worked!

Ed Kolis
October 16th, 2005, 10:20 PM
The templatizer is a program I wrote which would take a "template" file containing formulas for component families and such and convert it into a full-fledged SE4 data file. The latest version is version 4.0.0, but unfortunately that version was lost, and the previous version, version 3.0.5, is a bit of a pain to get running in Windows, as it relies on a GNU C mathematical library to run. (Previous versions used my own mathematical library, which was very buggy; version 4 used a Java mathematical library. I started working on a version 5 which would have had a graphical user interface, but gave up on that http://forum.shrapnelgames.com/images/smilies/frown.gif) I think I might still have version 3.0.5 (or at least some version near it) at school, though...
Of course, the templatizer will hopefully be rendered obsolete when SE5 comes out, as we're supposed to have formula parsing integrated directly into the data files http://forum.shrapnelgames.com/images/smilies/wink.gif

Will
October 17th, 2005, 12:56 AM
The point of INT is to be used as a FLOOR() function, which returns the next-lowest integer value for real number input (if the input is an integer, the function returns the input). TRUNC on the other hand, just takes any real number, and removes any decimal digits that it may have.

So yes, for positive real numbers, there is no difference between the results of INT and TRUNC. And for negative real numbers, there is no difference between CIEL and TRUNC. But there are uses for all three.