+ Reply to Thread
Results 1 to 3 of 3

VBA: How to create a function to divide the smallest number by the largest within a range

  1. #1
    Registered User
    Join Date
    06-03-2015
    Location
    Canada
    MS-Off Ver
    2011
    Posts
    1

    VBA: How to create a function to divide the smallest number by the largest within a range

    Hi, I'd like to know how to create a function by selecting a range (A1 to A30) and for the function to select the smallest number to divide by the largest one.
    Example:
    A1 50
    A2 48
    A3 45
    A4 44
    A5 40
    A6 38
    A7 30


    I want my function to select A1 and A2 and divide A2 by A1 (48/50). I tried:

    Please Login or Register  to view this content.
    It didn't work
    Last edited by zbor; 06-03-2015 at 02:50 PM.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: VBA: How to create a function to divide the smallest number by the largest within a ra

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: VBA: How to create a function to divide the smallest number by the largest within a ra

    You don't need VBA for this.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    would be enough.

    But if you want to create function for this you can do that as:

    Please Login or Register  to view this content.
    Using it as

    Formula: copy to clipboard
    Please Login or Register  to view this content.

+ 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. [SOLVED] Output one instance of the smallest AND largest value in a range
    By dchubbock in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-09-2013, 04:08 PM
  2. Excel 2007 : sort smallest number to largest
    By ravihotwok in forum Excel General
    Replies: 1
    Last Post: 12-06-2011, 11:35 AM
  3. % of difference between smallest and largest #s in a range
    By jomili in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-06-2010, 08:03 AM
  4. Returning the Nth Largest / Smallest Values in a Range
    By ExcelTip in forum Tips and Tutorials
    Replies: 0
    Last Post: 08-29-2005, 07:53 AM
  5. [SOLVED] Getting the 2nd largest or smallest valuesin a range
    By Michael Rekas in forum Excel General
    Replies: 5
    Last Post: 01-31-2005, 04:06 AM

Tags for this Thread

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