Changing from division formula output to a Ratio

Copper Contributor

Ok.  I am trying to set up an automated combat table for one of my favorite board war games.  One of the first things I did was the simple attacker strength divided by the defender strength.  I will use an example.  Let's say the attacker strength is 10, and the defender strength is 40 (not a good idea attacking an enemy that is that strong).  When I divide that out, it comes out to 4 (i.e., defender strength divided by attacker strength), but what I am looking for is a ratio.  I want the cell output to actually say 1:4 (i.e., 10 to 40).  Right now, I just have a simple formula of =sum(f2/f3), where f2 is the Defender Strength and f3 is the attacker strength.  How can I tweak my formula so that the cell output is in a ratio?  

3 Replies
Ok. I did a little more digging, and I found this formula, =F2/GCD(F2,F3)&":"&F3/GCD(F2,F3). And that works. In my example above, that gives me a 1:4 ratio, which is right on.

@mnmanstein Or just format the cell with the division as a Ratio.

Screenshot 2022-04-27 at 07.11.43.png

@Riny_van_Eekelen 10-4!  That would be even easier.  Thanks!!