Spreadsheet Help

PeteAtoms

FormulaRandom
Joined
Aug 13, 2002
Messages
3,722
Location
Land of Ooo
I have a bunch of numbers in column A.

I have a number (X) in cell B1

I want to sum all all the numbers in column A from A1 to AX, and have the total appear in C1.

I also want to be able to reenter a value for X in cell B1 and have the sum auto-update in C1.
-----------------------------------

Second question is in regards to random numbers. I have the random function in cell A1.

In cell A2, I have number Y.

I want to somehow generate Y number of random numbers and have them appear in column C.

Any help or should I have gone to the official forums first :p Hoping someone here can spare me having to create an account at another forum.

I remember being able to create random numbers using TI:Basic on my calculator and RantInt(A,B,C), which generated C number of random integers between A and B. Which I was easily able to automatically send it to a List (L1) and summing that List was a piece of cake Sum(L1).

Trying to recreate something like that on a spreadsheet.
 
I didn't have time to read your second question in detail but the answer to your first question is:

=SUM(A1:INDIRECT("A"&B1))

You'd enter this formula in C1.
 
I didn't have time to read your second question in detail but the answer to your first question is:

=SUM(A1:INDIRECT("A"&B1))

You'd enter this formula in C1.

That did it, thank you :goodjob:
 
I made a spreadsheet to demonstrate how you can do the 2nd thing, assuming there is a limit to what Y can be. I'm not sure what the purpose of the random function in cell A1 is, so I left it out.

Here is the Google Docs spreadsheet: https://docs.google.com/spreadsheet/ccc?key=0Aj-alvjm02wjdElkNEVua244VkVaaGcxa2MyLWRyVEE

P.S. You can use "=randbetween(a,b)" to generate an integer between "a" and "b", "=rand()*b" to get a random decimal number between 0 and b, or "=rand()*(b-a) + a" to get a random number btwn a and b.
 
For your second question, it's easy enough to generate a column of random numbers, but not so easy to limit the number displayed based on a cell value. Assuming that column B contains a sequence of natural numbers(1-X), and you want random numbers 0 to 10, then you could write C1 as:
=IF(LESS(B1<=$A$2),FLOOR(RAND()*10),"")

Then drag that down (and column B) to the maximum value of y. I haven't checked this, mind, so I may have messed something up, even in this snipet.

Note that this will generate the maximum number of random numbers, but only display Y. spreadsheets aren't optimized for efficient calculation.

EDIT:Mise beat me to it. His spreadsheet is exactly what I was describing
 
Back
Top Bottom