Sum Totals without including amount past decimal point

Hi,
First of all I have calculated how many whole things I can get for a sum of money. So for example, if I need to know how many apples I can get I can do:
Amount of money I have/ cost of apples.
Example
I have $10 and the cost of an apple is $1.26 an apple
Answer= I can get 7.93650793651 Apples

But I can’t buy part of an apple and I need to be able to copy and paste the result into a formula that will only add using the whole number of whole apples and not add up anything past the decimal point.

I can of course change the format of the cell to not include anything past the decimal point but the issue with that is that when I then use the total and try to calculate with it, calc will ‘know’ what is past the decimal point and will use it in a calculation.

Any help much appreciated.

[x] Precision as shown
imagen

  1. Ordinary numbers formatted to 0 decimals are not shown rounded down, but rounded the usual way.
  2. “Precision as shown” would be applied to every calculation, not just where it is actually wanted.
    Never use this poisonous setting.

Assuming A1 is your funding and B1 is the unit price:

=ROUNDDOWN(A1/B1;0) will return 7 for the sample values in your question.

1 Like

Hi Robleyd
Perfect, thank you very much for your time and help.
Kind regards
Simon

also called INT()

Unfortunatly NOT in LO-calc:

original =INT(A2) =ROUNDDOWN(A2)
-3,5 -4 -3
-2,5 -3 -2
-1,5 -2 -1
-0,5 -1 0
0,5 0 0
1,5 1 1
2,5 2 2
3,5 3 3
4,5 4 4
5,5 5 5
1 Like

apples with a negative price ? :thinking:

$10 would get an infinity of them then ! :wink:

This is not about apples or pears, it is about the behaviour of =INT() for negative Values

OP was.

ok, so =INT(ABS())*SIGN() :innocent:

1 Like

Well, OP was using apples as an example. Of course, as we well know, the example provided often has no relationship to the real problem. So we might well be talking about e.g. wholesale electricity prices in Australia which are sometimes a negative value. Or perhaps it is quinces, not apples :slight_smile:

1 Like

sure, so back to the interesting question : how many do you get for 10 AUD ? :wink:

INT() fortunately acts as the mathematicl function for “next not greater integer” always did. An old notation in math print was [x] for INT(x), and serious programming languages followed this interpretation from the beginning. And even EXCEL also does it this way.
So still holds INT(X) = X - MOD(X; 1)
Unfortunately ROUNDDOWN() follows a misleding interpretation of “down”.
See also:
disask112140ROUNDDOWNvsINT.ods (25.5 KB)

YOU knew it from the beginning, python was, is and will never be a serious programming language! ROFL
edit: it seems JAVA is also one of these NONSERIOUS languages.
https://stackoverflow.com/questions/2143476/how-to-cast-a-double-to-an-int-in-java-by-rounding-it-down

I made one serious mistake many years ago when I rejected an absolutely uninformed comment about Pascal and wrote that the usage of Python followed a “hype”. That was clearly an opinion and not a claim to know better. It was induced by my observations concerning Java.
Anyway: Even without knowing the details I feel sure that Python also is a serious programming language, and that it also has an INT() function acting exactly as the mathematical INT() does.
@karolus: Please accept my statement that I’m not at all interested in fights.
You probably remeber this post of mine.

Hello, colleagues!
Many programming languages ​​appeared quite a long time ago, when there was no Internet and forums…
For example, when the K&R book about the C language came out, I was already programming in Fortran and PL/1.
That’s why we can’t expect unification of function names. In VB(A) we have Int and Fix, in JS Math.floor and Math.trunc