这个肯定得用VBA才合适了,思路是这样,A1中存放待分解数X,B、C两列存放因数,循环1到X/2,判断与X相除的余数,如余数为0,则此数为X的因数,代码如下:
Sub AA()
Dim i, r
r = 1
With Sheet1
.Range("B:C").ClearContents '清除BC列原有数据
For i = 1 To Int(.Cells(1, 1) / 2)
If .Cells(1, 1) Mod i = 0 Then
.Cells(r, 2) = i
.Cells(r, 3) = .Cells(1, 1) / i
r = r + 1
End If
Next
'下面这一段代码删除重复项
For i = r - 1 To 2 Step -1
If Application.WorksheetFunction.CountIf(.Range("C1:C" & i - 1), .Cells(i, 2)) = 1 Then
.Rows(i).Delete
End If
Next
End With
End Sub