how to find the gcd of two numbers in ms excel 2000

B

blcarmadillo

Hi, I was wondering if anyone knows how to find the greatest common
denominator (gcd) of two numbers in microsoft excel 2000. Thanks for
any help.
 
D

daddylonglegs

You can use GCD function which is part of Analysis ToolPak addin,
otherwise this formula will give you the greatest common denominator of
two integers in A1 and B1

=MAX(IF(MOD(A1,ROW(INDIRECT("1:"&A1)))=0,IF(MOD(B1,ROW(INDIRECT("1:"&A1)))=0,ROW(INDIRECT("1:"&A1)))))

confirmed with CTRL+SHIFT+ENTER
 
B

blcarmadillo

Thanks davesexcel and daddylonglegs for the reply. I really would like
to have it so that anyone can use my spreadsheet without having to load
add-ons so I think the best bet would be to try using some formula. I
tried using the formula daddylonglegs posted: > =MAX(IF(MOD(A1,ROW(INDIRECT("1:"&A1)))=0,IF(MOD(B1
,ROW(INDIRECT("1:"&A1)))=0,ROW(INDIRECT("1:"&A1))) )) I'm using fields C2 and D2 though so I replaced all the A1 attributes
with an attribute of C2 and the B1 attribute with the attribute D2. In
cell C2 I had the value: 4; and in D2 I had the value: 12. Therefore, I
should have gotten an answer of: 4; however, I got an answer of 1. An
help is greatly appreciated. Thanks.
 
D

daddylonglegs

Hi, it's the correct formula but you need to confirm it with
CTRL+SHIFT+ENTER.

If you have the formula already on your sheet select that cell then
press F2 then while holding down CTRL+SHIFT buttons press ENTER. Curly
braces like { should appear around your formula and you should get the
correct result
 
Top