Factors of a Number


Posted by Michael on July 18, 2001 12:01 PM

Is there an excel formula to return the factors of a number?
e.g. Factor of 6 = 1 * 2 * 3

Posted by IML on July 18, 2001 12:06 PM

In =Fact(), there is (NT)

Posted by IML on July 18, 2001 12:09 PM

I think I mis-read as usual - sorry.

that formula is for the factorial funciton, but it looks like you want to go the other way.

Posted by Mark W. on July 18, 2001 12:10 PM

FACT() is Factorial -- Not Factors

Posted by Michael on July 18, 2001 12:57 PM

So there is not a way?



Posted by AB on July 19, 2001 6:28 AM

I suppose you could always create your own function...

Function Factors(x As Integer) As String
Application.Volatile
Dim i As Integer
Factors = x
For i = x - 1 To 1 Step -1
If x / i = Int(x / i) Then
Factors = Factors & ", " & i
End If
Next i
End Function


If you define the above function in a VBA module in your workbook you will have a function that returns all factors of a whole number.

Assume: [A1] is the number 76
Usage: [B1] =Factors(A1)
Result: [B1] 76, 38, 19, 4, 2, 1


Regards,
AaronThe Excel Logic Page