+ Reply to Thread
Results 1 to 7 of 7

Distribute total value on mutliple columns based on ranks and maximal accepted quantity

  1. #1
    Registered User
    Join Date
    12-23-2012
    Location
    Banja Luka, B&H
    MS-Off Ver
    MS Office Excel 365
    Posts
    20

    Question Distribute total value on mutliple columns based on ranks and maximal accepted quantity

    Hi all,

    This one is really tricky. I need to relocate some total (relocation) values to columns based on given ranks. But tricky part is that you should not relocate to columns above their max accepted value. For example: formula finds column with rank 1, it fulfills it max accepted quantity first, after it finds columns with rank 2, 3, 4, 5 to fulfill their needs, until it consumes total (relocation) value. So, the ranks, accepted quantaties per column (company) and Total Relocation value are given values and conditions. I must calculate relocation values per company based on these conditions in example. I marked with yellow color where formulas should go. Excel example in attachment.

    example_ss1.png
    Attached Files Attached Files

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,025

    Re: Distribute total value on mutliple columns based on ranks and maximal accepted quantit

    In K3, copied across and down:
    =IFERROR(1/(1/IF($J3-SUMPRODUCT(($B3:$E3=ROW(INDIRECT("1:"&B3)))*$F3:$I3)>0,F3,MAX(0,F3+$J3-SUMPRODUCT(($B3:$E3=ROW(INDIRECT("1:"&B3)))*$F3:$I3)))),"")
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Registered User
    Join Date
    12-23-2012
    Location
    Banja Luka, B&H
    MS-Off Ver
    MS Office Excel 365
    Posts
    20

    Re: Distribute total value on mutliple columns based on ranks and maximal accepted quantit

    I don't know what to say. This works perfectly. I hope it will be helpful for someone else also, I've been struggling with this for a long time.

    Thanks and excellent job Glenn!

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,025

    Re: Distribute total value on mutliple columns based on ranks and maximal accepted quantit

    You're welcome.



    If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.

  5. #5
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,908

    Re: Distribute total value on mutliple columns based on ranks and maximal accepted quantit

    One way:

    =IF($J3-SUMPRODUCT(($B3:$E3<B3)*$F3:$I3)>0,MIN(F3,$J3-SUMPRODUCT(($B3:$E3<B3)*$F3:$I3)),"")

  6. #6
    Registered User
    Join Date
    12-23-2012
    Location
    Banja Luka, B&H
    MS-Off Ver
    MS Office Excel 365
    Posts
    20

    Re: Distribute total value on mutliple columns based on ranks and maximal accepted quantit

    Quote Originally Posted by Phuocam View Post
    One way:

    =IF($J3-SUMPRODUCT(($B3:$E3<B3)*$F3:$I3)>0,MIN(F3,$J3-SUMPRODUCT(($B3:$E3<B3)*$F3:$I3)),"")
    Also works nice. This is shorter formula. Less code, it should be faster then previous one. Am I right?

    I'm using data of 10-15 columns (companies), and over 400.000 rows.

  7. #7
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,908

    Re: Distribute total value on mutliple columns based on ranks and maximal accepted quantit

    If the data has 15 columns and more than 400,000 rows, using VBA would probably be better.

+ 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. Replies: 1
    Last Post: 04-11-2019, 12:17 PM
  2. Replies: 7
    Last Post: 10-11-2018, 02:18 PM
  3. A formula for evenly distribute the Quantity.
    By picztom in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-02-2018, 06:52 AM
  4. [SOLVED] Running total of Quantity on Hand Vs Sales Vs Quantity to Produce
    By jespo1351 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-01-2015, 07:34 AM
  5. [SOLVED] Highlight cell based on total quantity value based on repeated order numbers
    By PWilson0727 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-29-2014, 02:02 PM
  6. [SOLVED] Distribute values in columns based on match between two other columns
    By hydrgal in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-15-2013, 04:07 AM
  7. Summing Total Sales, Based on Quantity & Price
    By ExcelTip in forum Tips and Tutorials
    Replies: 0
    Last Post: 08-28-2005, 11:08 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