简体   繁体   English

excel跨范围分配值

[英]excel distribute values across range

i need a formula to distribute values across a range while accounting for the max value possible 我需要一个公式来在一个范围内分配值,同时考虑可能的最大值

conditions to check: 检查条件:

  1. IF the cell value is less than max then take cell value, ELSE 如果单元格值小于最大值,则取单元格值,否则为
  2. subtract cell value from max AND 从最大AND中减去像元值
  3. check conditions if there is a remainder in the subtraction and add to the next row; 检查条件,如果减法中没有余数,则添加到下一行; otherwise place 0 否则放置0

sample data & ideal outcome breakdown is the ideal outcome 样本数据和理想结果 breakdown是理想结果

在此处输入图片说明

i know VBA can solve this but i'd rather not if possible. 我知道VBA可以解决此问题,但我宁愿不要这样做。 thanks for any help. 谢谢你的帮助。

Also, not against using a helper column :) 另外,不反对使用帮助列:)

Updated 更新

when the values are the same on the series, it replaces with a 0 any idea it can dynamically reset based on the length of the series 当系列中的值相同时,它将替换为0的任何想法,它可以根据系列的长度动态重置

在此处输入图片说明

put this in B3 and copy down: 将其放入B3并复制下来:

=IF(A3<>A2,MIN(A3,$B$1),MIN(A3-SUM(INDEX(B:B,MATCH(A3,A:A,0)):B2),$B$1))

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM