View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Erich Neuwirth Erich Neuwirth is offline
external usenet poster
 
Posts: 41
Default GCD & LCM: ANALYSIS TOOLPAK

Put the 2 numbers on top of each other.
In the cell below put
=MOD(number above, number 2 rows above), and copy the formula
down a few cells.
In the end, you will get division by zero.
The last nonzero number in this column is the GCD.
The product of the 2 numbers divided by the GCD is the LCM.
For 3 numbers, the GCD is the GCD of the gcd of the first two
with the third number, and so on.
Likewise, the LCM of 3 numbers is the LCM of the LCM of the first two
with the third number.


If you are interested in math with spreadsheets,
you migth want to have a look at out book:

The Active Modeler - Mathematical Modeling with Microsoft Excel
Erich Neuwirth - University of Vienna (Austria)
Deane Arganbright - University of Tennessee, Martin
ISBN 0534420850
http://www.amazon.com/exec/obidos/tg...books&n=507846


Matt Dunbar < wrote:

BTW

i know that for 2 numbers the following works which is great

=MAX(A1:A2)*LEFT(TEXT(MIN(A1:A2)/MAX(A1:A2),"000000000000000/000000000000000"),15)

but i have to cope with 2 or 3 or 4 numbers also

matt


---
Message posted from http://www.ExcelForum.com/