A Different way to Calculate Ratios using GDC & or MIN ?

StrawberryDreams

Board Regular
Joined
Mar 26, 2022
Messages
79
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
  3. Mobile
Simply put , what is the best formula to write Ratios for both 2 numbers, and 3 or more numbers ?

I've tried using GDC and MIN on both 2 and 3 number ratios and both formulas can be broken. They either don't properly get the lowest number as 1, or they show DIV/O errors, or GDC panics when using decimals. Is there a bullet proof formula so I can get any possibility to work ?

Is there a better way to do what I want ? You can see in the example the yellow cells are the "problem cells."


Basic data calculator test 9.4.xlsm
ABCDEFG
1Value 1Value 2Value 3Ratio using GDC ( Value 1 & 2 )Ratio using MIN ( Value 1 & 2 )Ratio formula for three or more numbers ? GCDRatio formula for three or more numbers ? Using MIN
292329 : 231 : 2.569 : 23 : 24.5 : 11.5 : 1
3239223 : 92.56 : 123 : 9 : 211.5 : 4.5 : 1
427329 : 19 : 127 : 3 : 213.5 : 1.5 : 1
532791 : 91 : 91 : 9 : 31 : 9 : 3
640.521 : 0.1258 : 12 : 0.25 : 18 : 1 : 4
70.5400.125 : 11 : 80.125 : 1 : 0#DIV/0!
80.00890.230.1234#DIV/0!1 : 25.84#DIV/0!1 : 25.84 : 13.87
9000Nil#DIV/0!Nil#DIV/0!
10001Nil#DIV/0!Nil#DIV/0!
110100 : 1#DIV/0!0 : 1 : 0#DIV/0!
121001 : 0#DIV/0!1 : 0#DIV/0!
131011 : 0#DIV/0!1 : 0#DIV/0!
140110 : 1#DIV/0!0 : 1 : 1#DIV/0!
Sheet1
Cell Formulas
RangeFormula
D2:D14D2=IF(B2=0,IF(A2=0,"Nil",A2&" : "&0),A2/GCD(A2:B2)&" : "&B2/GCD(A2:B2))
E2:E14E2=ROUND(A2/MIN(A2,B2),2) & " : " & ROUND(B2/MIN(A2,B2),2)
F2:F14F2=IF(B2=0,IF(A2=0,"Nil",A2&" : "&0),A2/GCD(A2:C2)&" : "&B2/GCD(A2:C2)&" : "&C2/GCD(A2:C2))
G2:G14G2=ROUND(A2/MIN(A2,B2,C2),2) & " : " & ROUND(B2/MIN(A2,B2,C2),2) & " : " & ROUND(C2/MIN(A2,B2,C2),2)
 
Try like
Book1
ABCDE
1Value 1Value 2Value 32 #3 #
23013 : 03 : 0 : 1
33103 : 13 : 1 : 0
40230 : 20 : 2 : 3
53003 : 03 : 0 : 0
6003Nil0 : 0 : 3
Sheet2
Cell Formulas
RangeFormula
D2:D6D2=IF(SUM(A2:B2)=0,"Nil",TEXTJOIN(" : ",,ROUND(A2:B2/MIN(IF(A2:B2=0,1,A2:B2)),2)))
E2:E6E2=IF(SUM(A2:C2)=0,"Nil",TEXTJOIN(" : ",,ROUND(A2:C2/MIN(IF(A2:C2=0,1,A2:C2)),2)))
Seems the code works great when it's just for the 2's . I tried for comparison putting up my countif formula which does the same as yours,
But for the 3's....Still its having issues when there is a Zero and the two other numbers are greater then 1 it seems.

Basic data calculator test 9.4.xlsm
ABCDEFGH
1Value 1Value 2Value 32's - my count if formula3's - my count if FormulaYour newest 2'sYour newest 3'sShould be for the 3's
23013 : 03 : 0 : 13 : 03 : 0 : 1
33103 : 13 : 1 : 03 : 13 : 1 : 0
41301 : 31 : 3 : 01 : 31 : 3 : 0
50230 : 20 : 2 : 30 : 20 : 2 : 3 0 : 1 : 1.5
63201.5 : 13 : 2 : 01.5 : 13 : 2 : 01.5 : 1 : 0
73023 : 03 : 0 : 23 : 03 : 0 : 21.5 : 0 : 1
80030 : 00 : 0 : 3Nil0 : 0 : 3
92481 : 21 : 2 : 41 : 21 : 2 : 4
100480 : 40 : 4 : 80 : 40 : 4 : 80 :1 : 2
111081 : 01 : 0 : 81 : 01 : 0 : 8
124321.33 : 12 : 1.5 : 11.33 : 12 : 1.5 : 1
134024 : 04 : 0 : 24 : 04 : 0 : 22 : 0 : 1
Sheet3
Cell Formulas
RangeFormula
D2:D13D2=IF(COUNTIF(A2:B2,"=0"), A2 & " : " & B2, ROUND(A2/MIN(A2,B2),2) & " : " & ROUND(B2/MIN(A2,B2),2) )
E2:E13E2=IF(COUNTIF(A2:C2,"=0"), A2 & " : " & B2 & " : " & C2, ROUND(A2/MIN(A2,B2,C2),2) & " : " & ROUND(B2/MIN(A2,B2,C2),2) & " : " & ROUND(C2/MIN(A2,B2,C2),2) )
F2:F13F2=IF(SUM(A2:B2)=0,"Nil",TEXTJOIN(" : ",,ROUND(A2:B2/MIN(IF(A2:B2=0,1,A2:B2)),2)))
G2:G13G2=IF(SUM(A2:C2)=0,"Nil",TEXTJOIN(" : ",,ROUND(A2:C2/MIN(IF(A2:C2=0,1,A2:C2)),2)))
 
Upvote 0

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Book1
ABCDE
1Value 1Value 2Value 3Your newest 2'sNew for the 3's
23013 : 03 : 0 : 1
33103 : 13 : 1 : 0
41301 : 31 : 3 : 0
50230 : 20 : 1 : 1.5
63201.5 : 11.5 : 1 : 0
73023 : 01.5 : 0 : 1
8003Nil0 : 0 : 1
92481 : 21 : 2 : 4
100480 : 40 : 1 : 2
111081 : 01 : 0 : 8
124321.33 : 12 : 1.5 : 1
134024 : 02 : 0 : 1
Sheet3
Cell Formulas
RangeFormula
D2:D13D2=IF(SUM(A2:B2)=0,"Nil",TEXTJOIN(" : ",,ROUND(A2:B2/MIN(IF(A2:B2=0,1,A2:B2)),2)))
E2:E13E2=IF(SUM(A2:C2)=0,"Nil",TEXTJOIN(" : ",,ROUND(A2:C2/SMALL(A2:C2,(COUNTIF(A2:C2,0)+1)),2)))


Good Night! ;)
 
Upvote 0
Book1
ABCDE
1Value 1Value 2Value 3Your newest 2'sNew for the 3's
23013 : 03 : 0 : 1
33103 : 13 : 1 : 0
41301 : 31 : 3 : 0
50230 : 20 : 1 : 1.5
63201.5 : 11.5 : 1 : 0
73023 : 01.5 : 0 : 1
8003Nil0 : 0 : 1
92481 : 21 : 2 : 4
100480 : 40 : 1 : 2
111081 : 01 : 0 : 8
124321.33 : 12 : 1.5 : 1
134024 : 02 : 0 : 1
Sheet3
Cell Formulas
RangeFormula
D2:D13D2=IF(SUM(A2:B2)=0,"Nil",TEXTJOIN(" : ",,ROUND(A2:B2/MIN(IF(A2:B2=0,1,A2:B2)),2)))
E2:E13E2=IF(SUM(A2:C2)=0,"Nil",TEXTJOIN(" : ",,ROUND(A2:C2/SMALL(A2:C2,(COUNTIF(A2:C2,0)+1)),2)))


Good Night! ;)
thanks again for all your input and time !
 
Upvote 0

Forum statistics

Threads
1,224,856
Messages
6,181,427
Members
453,040
Latest member
Santero

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top