+ Reply to Thread
Results 1 to 8 of 8

How to calculate a number based on the given ratio. For example a 2:3 ratio.

  1. #1
    Registered User
    Join Date
    10-03-2015
    Location
    London
    MS-Off Ver
    2010
    Posts
    76

    How to calculate a number based on the given ratio. For example a 2:3 ratio.

    Let's imagine I have two sets of things:

    Water bottles
    Coke bottles

    And in my excel I put my ratio of water bottles to coke bottles as lets say 2:3.

    Now lets say in the water bottles say I enter 50. I want excel to automatically calculate how many coke bottles I will have based on my ratio 2:3.

    If anybody can help with this? Perhaps provide an example worksheet.

    Thanks

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: How to calculate a number based on the given ratio. For example a 2:3 ratio.

    Is there a reason you need VBA for this? It can be done easily with a formula. For example:

    In cell A1, type Ratio.

    Format cell A2 as text and type 2:3 into it.

    In cell B1, type Coke.

    In cell B2, type 50.

    In cell C1, type Water.

    In cell C2, insert this formula:

    Please Login or Register  to view this content.
    Does this help?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    10-03-2015
    Location
    London
    MS-Off Ver
    2010
    Posts
    76

    Re: How to calculate a number based on the given ratio. For example a 2:3 ratio.

    Can you kindly provide a quick worksheet so I can visualise it?

    Oh and I thought VBA may be needed to write the ratio. Didn't know it could be done this way

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: How to calculate a number based on the given ratio. For example a 2:3 ratio.

    Please see here:
    Attached Files Attached Files

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: How to calculate a number based on the given ratio. For example a 2:3 ratio.

    Hi

    Assuming you have the text "2:3" in A1, (and please note that if you just enter 2:3 in A1 it will default to a time value and this will not work) and 50 in B1 then the number if coke bottles is
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    It would be simpler of you entered the ratio as 2 numbers in separate cells, e.g in A1 & B1 enter 2 & 3, and 50 in C1. Then the calculation is
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  6. #6
    Registered User
    Join Date
    10-03-2015
    Location
    London
    MS-Off Ver
    2010
    Posts
    76

    Re: How to calculate a number based on the given ratio. For example a 2:3 ratio.

    Thanks a lot And what does LEFT imply?

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: How to calculate a number based on the given ratio. For example a 2:3 ratio.

    If you have the formula =left(A1,1), then it will return whatever is leftmost in the cell, so if the cell contains 2:3, it will return 2. If you change the formula to =left(A1,2), then it will return 2: (i.e. the first two characters or numerals that are leftmost in the cell). Hope this helps!

  8. #8
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: How to calculate a number based on the given ratio. For example a 2:3 ratio.

    And the question you didn't ask, what's the Find for.

    All is OK and simple if your ratio is always two single digits, e.g. 2:3, but if the ratio was say 25:35 then you'd need the two left and two right characters. That's what the Find does. In other words it generalises the solution so that you can have as many digits as you want without needing to change the formula. e.g 123:45

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Improve "Fit Sheet on One Page"! Alter print area ratio to = A4 sheet ratio
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-27-2015, 10:16 PM
  2. How can I calculate the Critical Ratio using Excel 2003?
    By Taghreed Mahmoud in forum Excel General
    Replies: 0
    Last Post: 06-01-2012, 06:22 AM
  3. Replies: 2
    Last Post: 12-22-2011, 11:38 AM
  4. [SOLVED] Divide x/y should give Ratio x:y,How to express ratio in excel
    By arvind3738 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-10-2006, 03:29 AM
  5. How do I calculate and display ratio ( format 3.5:2)
    By BKW in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-28-2005, 03:05 PM
  6. Replies: 8
    Last Post: 09-13-2005, 02:05 PM
  7. Replies: 1
    Last Post: 08-19-2005, 05:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1