Forum Home
Press F1
 
Thread ID: 91995 2008-07-25 04:12:00 Spreadsheet kung-fu assistance Chilling_Silence (9) Press F1
Post ID Timestamp Content User
691989 2008-07-25 04:12:00 Hi all,

Been having fun with spreadsheets.
Basically B8 currently equals 6.
Now I want C8 to sorta say "For every 5 or part-thereof in B8, add 1 to C8"
So B8 = 1 then C8 = 1
B8 = 5 then C8 = 1
B8 = 9 then C8 = 2
B8 = 15 then C8 = 3

How would I go about doing that?
Chilling_Silence (9)
691990 2008-07-25 04:25:00 Does modulus (%) work in Excel (ie 9 % 5 = 1, which is the remainder when 9 is divided by 5)?

In C...


if (b8 <= 5)
...C8++;

else
...if (b8 % 5 == 0)
......c8 = c8 + (b8 / 5);
...else

Not sure if you know C, but I'm useless on Excel formulae!!

Using mod, you can determine if the number in B8 is a multiple of five or not, then you can see how many should be added to c8.

EDIT: Excel uses the MOD function.
jwil1 (65)
691991 2008-07-25 04:27:00 Not too sure... Im using Google Spreadsheets, but was never even really a whiz with Excel :-/ Chilling_Silence (9)
691992 2008-07-25 04:44:00 I tried:
=MOD(B8,5)

But it rounds down, I want it to round up :(


Hmmm......
Chilling_Silence (9)
691993 2008-07-25 04:50:00 =MROUND(B8,5) is getting closer, but rounds down, so if B8 is 6, then C8 shows 5.. I want it to show 10... :( Chilling_Silence (9)
691994 2008-07-25 05:12:00 =INT(B8/5) + CEILING(MOD(B8,5)/5, 1)

This works in Excel - not sure if it'll work in Google Spreadsheets
somebody (208)
691995 2008-07-25 05:35:00 I think QUOTIENT is probably the simplest function for what you want CS. It's in Excel - not sure about Google - no reason it shouldn't be....... Miami Steve (2128)
691996 2008-07-25 05:44:00 In Ooo spreadsheet in C8 the formula is =ROUNDUP(B8/5; 0)

In Excel in C8 the formula is =ROUNDUP(B8/5,0)

JohnB
JonB (1885)
691997 2008-07-25 05:52:00 Excellent! Thanks guys, got it now :) Chilling_Silence (9)
1