|
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
In Excell, not even using a script:
1) Fill column A with the numbers 1 to 999, with one number in each cell.
* type 1 in cell A1, press enter.
* type 2 in cell A2, press enter.
* Click and drag to select those 2 cells, drag-expand the selection from the lower-right corner to fill the column A with numbers up to 999.
2) isolate the numbers which are multiples of 3 or 5.
* In cell B1, type the following:
=IF(MOD(A1,3)=0,A1,IF(MOD(A1,5)=0,A1,0))
* press enter.
* select cell B1 and double-click on the lower-right corner of the cell. (this should fill the cells in column B exactly where you want it to and no more)
3) Find the sum of the isolated numbers.
* In any cell that is not already used, and not in column B, type the following:
=SUM(B:B)
The answer is 233,168
|