I have successfully created a ratio using the following code below:
Function RATIO(num1, num2) As Variant
With Application
RATIO = (num1 / WorksheetFunction.Gcd(num1, num2)) & ":" & (num2 / WorksheetFunction.Gcd(num1, num2))
End With
End Function
Result returns as such:
What I would like to do now is take it further and be able to take it further and allow it to do a ratio within a range. End result should look like this:
I know it means starting the code off with Function RATIO(range) As Variant. Then when I enter the formula I'll need to have one line for the first cell in the range and then a loop for all the other cells so they start with ":" followed by the number.
Any help please?
Function RATIO(num1, num2) As Variant
With Application
RATIO = (num1 / WorksheetFunction.Gcd(num1, num2)) & ":" & (num2 / WorksheetFunction.Gcd(num1, num2))
End With
End Function
Result returns as such:
What I would like to do now is take it further and be able to take it further and allow it to do a ratio within a range. End result should look like this:
I know it means starting the code off with Function RATIO(range) As Variant. Then when I enter the formula I'll need to have one line for the first cell in the range and then a loop for all the other cells so they start with ":" followed by the number.
Any help please?