RATIO is used to compare two values with each other. In the Excel we don’t have the single function to calculate the ratio.
We have used GCD function of excel to get the Ratio between two numbers. GCD returns the greatest common divisor between two or more numbers.
Below is the formula which we have used to calculate the Ratio in Excel:
=B2/GCD(B2:C2) & " : " & C2/GCD(B2:C2)
Function RATIO(first_number As Long, second_number As Long) As String Application.Volatile Dim gcd As Long gcd = Application.WorksheetFunction.gcd(first_number, second_number) RATIO = first_number / gcd & " : " & second_number / gcd End Function
After putting this UDF in the module of Visual Basic Editor, you can put the RATIO function in Excel-