+ Reply to Thread
Results 1 to 4 of 4

Trying to fill cells in order by known rank until overall criteria is met.

  1. #1
    Registered User
    Join Date
    04-20-2022
    Location
    Atlanta, GA
    MS-Off Ver
    Microsoft 365 Apps for business
    Posts
    2

    Trying to fill cells in order by known rank until overall criteria is met.

    Hello,

    I am attempting to fill cells based off a ranking system that I've created. I have values with an associated rank and I want to reference those ranks, then fill those values by lowest rank first, then next lowest rank, then next lowest and so on. My Excel sheet has an input for overall sum of values and I want to fill in those individual values by rank until my overall sum is reached or my values are maxed out. My file is attached.

    To explain this in terms of my file, I want to input a value into cell F2 and then run a macro that fills in values in Cells F5:F26 based off their ranking system in cells J5:J26, wherein the lowest rank is filled in first and then the next lowest and so on. In this case, the lowest rank is 1.0029, as found in cell M5, and matching that finding to cells J5:J26 (in this case cell J23 matches) would then insert a value of 90 into cell F23. The next finding would be cell M6 of 1.0035, and it would match to cell J19, thus indicating that a value of 151 would be inserted into cell F19. Once that occurs, cell F3 should equate to 69,759 since the original volume is subtracting 90 and 151 from 70,000. Once cell F3 reaches 0, then I would try to get the loop to stop.

    Please let me know if you have any guidance on how to approach this as I'm completely stumped. I can find the minimum value and paste in the ranking, but that's about as far as I've gotten. Any insight would be greatly appreciated.

    Thank you,
    Kniggit88
    Attached Files Attached Files

  2. #2
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Trying to fill cells in order by known rank until overall criteria is met.

    I added an extra helper column in P for Total Volume. Formula for P5 (no VBA required):

    Please Login or Register  to view this content.
    Then copied down to P26. Formula for F5 is then:

    Please Login or Register  to view this content.
    Copied down to F26. Note that it only takes 1956 of 2500 from row 20 to make it up to 70,000. Attached for reference.

    WBD
    Attached Files Attached Files
    Office 365 on Windows 11, looking for rep!

  3. #3
    Registered User
    Join Date
    04-20-2022
    Location
    Atlanta, GA
    MS-Off Ver
    Microsoft 365 Apps for business
    Posts
    2

    Re: Trying to fill cells in order by known rank until overall criteria is met.

    This is much appreciated, thank you. I've never utilized the LET function so I will have to look into that. Thank you for teaching me something new and I appreciate you adding the helper column in P as well.

  4. #4
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Trying to fill cells in order by known rank until overall criteria is met.

    Well ... it was possible without using =LET() but it just meant that I could avoid calculating the same value twice. Breaking this down:

    Please Login or Register  to view this content.
    Firstly, find the running total from column P that matches the value in column J5 by looking up a match in M5:M26. Assign this running total to a variable called t.
    Secondly, provided t is less than our target value, either allocate the full amount or just what's required to "top up" to the target value.

    LET() allows you to compute intermediate values and store the results for later use. It's new in 365 version which I saw you had.

    WBD

+ 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] Rank/Order including manual overriding rank/order input
    By 77highland in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-15-2021, 06:38 PM
  2. Automatically fill cell in rank order
    By jpc99 in forum Excel General
    Replies: 1
    Last Post: 07-08-2021, 09:40 PM
  3. assistance with match and rank order formula based on multiple criteria
    By OSepulvedaIII in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-18-2016, 06:21 AM
  4. Rank Teams in Performance Order - not as easy as just =Rank...
    By excelnat in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-06-2015, 12:12 PM
  5. Densed Rank with 2 critieria with Alphabetical Order as one criteria
    By hamson in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-19-2013, 06:15 AM
  6. Fill cells in decreasing order
    By Maanu in forum Excel General
    Replies: 5
    Last Post: 10-22-2010, 04:09 AM
  7. Replies: 3
    Last Post: 05-01-2010, 10:23 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