+ Reply to Thread
Results 1 to 2 of 2

using MAX formula for user-defined number of cells

  1. #1
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,173

    using MAX formula for user-defined number of cells

    I have a row of 10 numbers from cells A1:A10. I want to use the MAX function to find the largest value but I want to base it on a user-defined number of cells. The numbers of cells to use is always going to start from the right (cell A10).

    As an example, data is a follows:

    A1 = 50
    A2 = 100
    A3 = 900
    A4 = 10
    A5 = 40
    A6 = 500
    A7 = 20
    A8 = 90
    A9 = 300
    A10 = 200

    If the user wants to use 5 cells, then the max is 500 (finding the MAX in A6:A10). If the user wants to use 3 cells, then the max is 300 (finding MAX in A8:A10). And so on. Thanks in advance for any comments.
    Last edited by maacmaac; 01-03-2011 at 04:48 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: using MAX formula for user-defined number of cells

    Assuming:

    1) the user is entering the number of cells to use in cell D1
    2) numbrer of cells always refers to "the last X number of cells"

    ...then use this formula:

    =MAX(INDEX(A1:A10, 11-D1):A10)
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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