+ Reply to Thread
Results 1 to 2 of 2

Adjustable Variable in a Formula

Hybrid View

  1. #1
    Registered User
    Join Date
    02-18-2012
    Location
    Rhode Island, USA
    MS-Off Ver
    Excel Starter
    Posts
    7

    Adjustable Variable in a Formula

    I am trying to generate information for use in my Fantasy Baseball draft. I have an Excel spreadsheet (Excel Starter) that I use to rank the available players to assist me in my drafting. I use the sheet for a number of different leagues, so the information needs to have some variability. I have an algorithm I wrote that determines the 'scarcity' of a players position and a major component is how many teams are in the league. Obviously, with more teams it may be best to select a player from a particular position earlier in the draft.

    So, on my first sheet I have all the players listed by how they rank according to my algorithms. In column E, the players' position is listed. On my last sheet, I want to determine position 'scarcity' using how many players of a particular position would be available for each draft round. So, with 10 teams, there are 10 players chosen during each round. If I search the first 10 players from my rankings based upon position, I may find 3 catchers. But, if there are 12 teams in the league, than number could change.

    I am using the following formula to sort by catchers in the first 10 players:

    =COUNTIF(RANK!E3:E12,"C")

    It searches the first 10 cells for the "C" (catcher).

    What I need is for the "12" to be variable based upon the number of teams. If there are 12 teams, it should be:

    =COUNTIF(RANK!E3:E14,"C")

    That would search the first 12 cells for the "C" (catcher)

    If I place a cell within the last sheet that I enter the number of teams, how do I transfer that number into the COUNTIF formulation?

    Also, for the next round of the draft, the players to sort on are in cells E13 to E22 (for 10 teams), so BOTH row/column references need to be variable.

    Any suggestions?

  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: Adjustable Variable in a Formula

    You can use OFFSET to expand a range from a single cell to a range of a specific "height"... the height is controlled by the 4th parameter.

    =E3
    =OFFSET(E3, , , 12, )

    ...this resolves to E3:E14.

    You can use a cell value to provide that reference, so if M1 held the number of teams, you could use:
    =OFFSET(E3, , , M1, )

    Now, slip that into your RANK function:

    =RANK(OFFSET(E3, , , M1, ))

    Then finally your COUNTIF function:

    =COUNTIF(RANK(OFFSET(E3, , , M1, )), "C")


    Adapt from there as needed.
    _________________
    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