我需要在Excel中创建一个有条件的公式,包括相对和非相关条件在内
我在AI中具有AD列中的临界等级列 - 每个列具有1、2、3、4、5,N/A或空白。 AJ列只是一个占位符列,A列AK是我进行计算以提出重新平衡的临界等级,通过将每个评级从前六列乘以该评分区域的重量,在我的情况下,这些权重为六列中的30%,20%,20%,10%,15%,5%,这些权重在第729行中列出。我在处理727行数据时有两个目标:
- 如果有一个'n/a '或列中的空白,从这些列中获取百分比,然后将它们重新分配给其他列 。因此,在图像中的第一行中,评分为5,空白,2、1、1、5,权重为30%,20%,20%,10%,15%,5%。如果没有重新分配,则公式为(5 * 30%) +(空白 * 20%) +(2 * 20%) +(1 * 10%) +(1 * 15%) +(5 * 5% )= 1.5 + 0 + .4 + .1 + .15 + .25 = 2.4,这是占位符AJ列。我的公式确定n/a和空白汇总到代表20%的列,其中有5列具有值,因此我为这5列中的每一个添加了4%,而我的新数学变为(5 * 34%) ) +(空白 * 24%) +(2 * 24%) +(1 * 14%) +(1 * 19%) +(5 * 9%)= 1.7 + 0 + .48 + .48 + .14 + .19 + .19 + .45 = 2.96,这是重新平衡的AK列。一切都很好,我在Excel中使用的配方是:
= LET(总计,Sumif(AD2:AI2,“ N/A”,$ AD $ 729:$ AI $ 729)+SUMIF(AD2:AI2,“”,$ AD $ 729 :$ ai $ 729),count,countifs(ad2:ai2,“> = 1”,ad2:ai2,'< = 5“),sum(ifError(((ad $ 729:ai $ 729+$ 729+total/count/count)*ad2 :ai2,0)))
我的问题是关于下一个目标:
- 如果列中有“ n/a”或空白,请从这些列中获取百分比,然后将其重新分配给它们在其原始权重 上,其他列。因此,在图像中的第一行中,评分为5,空白,2、1、1、5,权重为30%,20%,20%,10%,15%,5%。如何编写公式,以便在这种情况下,根据AD和AI中AI中的列的百分比,通过AI添加了代表AF中的空白中空白中空白的20%?我仍然需要知道“总”,这是重新分配的百分比,在这种情况下为20%。但是我如何查看其余列,在这种情况下,这将是30%,20%,10%,15%,5%和重新分配20%相对于彼此相同吗? 列广告以30%的速度开始,Ag列的开始为10%,A linter AH的启动为15%,因此AD需要重量三倍AG和AH的两倍,我需要考虑到任何数量的列(最多6个)都可以有空白或N/A的事实。在这种情况下,新的加权百分比将为37.5%,0%,25%,12.5%,18.75%,6.25%。
提前致谢!
I have columns of criticality ratings in Columns AD through AI – each column has either a 1, 2, 3, 4, 5, N/A, or is blank. Column AJ is simply a placeholder column and Column AK is where I do my calculations to come up with a rebalanced criticality rating by multiplying each of the ratings from the first six columns by the weight of that rating area – in my instance, those weights are 30%, 20%, 20%, 10%, 15%, 5% across the six columns and these weights are listed in Row 729. I have two goals in processing the 727 rows of data:
- If there is an ‘N/A’ or a blank in a column(s), take the percentages from those columns and reassign them equally to the other columns. So, in the first row in the image, the ratings are 5, BLANK, 2, 1, 1, 5 and the weights are 30%, 20%, 20%, 10%, 15%, 5%. If there was no reassignment, the formula would be (5 * 30%) + (BLANK * 20%) +(2 * 20%) + (1 * 10%) + (1 * 15%) + (5 * 5%) = 1.5 + 0 + .4 + .1 + .15 + .25 = 2.4, which is the placeholder AJ column. My formula determines that the N/A and blank add up to columns representing 20% and there are 5 columns that have values in them, so I add 4% to each of those 5 columns, and my new math becomes (5 * 34%) + (BLANK * 24%) +(2 * 24%) + (1 * 14%) + (1 * 19%) + (5 * 9%) = 1.7 + 0 + .48 + .14 + .19 + .45 = 2.96, which is the rebalanced AK column. Everything works great and the formula I use in Excel is:
=LET(total,SUMIF(AD2:AI2,"N/A",$AD$729:$AI$729)+SUMIF(AD2:AI2,"",$AD$729:$AI$729),count,COUNTIFS(AD2:AI2,">=1",AD2:AI2,"<=5"),SUM(IFERROR((AD$729:AI$729+total/count)*AD2:AI2,0)))
My question is regarding the next goal:
- If there is an ‘N/A’ or a blank in a column(s), take the percentages from those columns and reassign them based on their original weights to the other columns. So, in the first row in the image, the ratings are 5, BLANK, 2, 1, 1, 5 and the weights are 30%, 20%, 20%, 10%, 15%, 5%. How do I write the formula so that in this instance the 20% representing the BLANK in Column AF is added to AD and AF through AI based on the percentages of the columns in AD and AF through AI? I would still need to know ‘total’, which is the percentage to reassign, and in this case is 20%. But how do I look at the remaining columns, which in this case would be 30%, 20%, 10%, 15%, 5%, and reassign the 20% such that the new percentages would be the same relative to each other? Column AD starts out at 30%, Column AG starts out at 10%, and Column AH starts out at 15%, so AD needs to wind up with a weight three times as much as AG and twice as much as AH, and I need to account for the fact that any number of columns (up to all 6) can have blanks or N/A’s. In this instance the new weighted percentages would be 37.5%, 0%, 25%, 12.5%, 18.75%, 6.25%.
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
那以下疯狂的公式呢?
假定为第2行的重量调整为第2行。将其存储为百分比(因此,如果将单元格式设置为一般,则将30%显示为0,3)。
首先构建,
如果合适的话,它首先返回给定单元的基本重量:
重量 *和( value &lt;&gt; 0, value value < /strong>&lt;&gt;“ n/a”)
,对行的每个单元重复:
cell 1 + 先前的cell公式的先前公式2 + 细胞3的先前公式 + 细胞4 + 先前的公式对于单元6 ,
用于划分价值和重量的乘积:
value * stroge /先前的公式< /strong>
实际上仅在必要时才会衡平:
if(or( value =“ n/a”, value = 0),0),0 ,以前的公式),
该行重复:
细胞1 + 先前的公式/strong> + 细胞3 + 的先前公式6
编辑:注释的请求
我们需要动态更改对第729行的(适当单元格中的(适当单元格)。为了实现此目的,我们将使用此公式:
indirect(硬编码列&amp;行(车辆列表的左上方单元格) - 1 +匹配(带有给定车辆的类型,车辆清单,0 )
我们将适应所需的每个单元格:
因此,我们将能够相应地替换它们并获得此信息:
第二次编辑,
我将其重新编写为公式,将其调整为新请求。尝试一下:
在这里一张表使范围更改的表更容易:
Crazy Formulas都需要疯狂的编辑方式。
What about the following crazy formula?
This one is tuned for the row 2. Weight are assumed to be stored as percentage (therefore if the cell format is set as general, 30% will be shown as 0,3).
The building up
First it return the base weight for the given cell if it's appropriate:
weight * AND(value<>0, value<>"N/A")
which is repeated for each cell of the row:
previous formula for cell 1 + previous formula for cell 2 + previous formula for cell 3 + previous formula for cell 4 + previous formula for cell 5 + previous formula for cell 6
which is used to divide the product of value and weight:
value * weight / previous formula
which is actually calulated only if necessary:
IF(OR(value = "N/A", value = 0), 0, previous formula)
which is repeated for each cell of the row:
previous formula for cell 1 + previous formula for cell 2 + previous formula for cell 3 + previous formula for cell 4 + previous formula for cell 5 + previous formula for cell 6
EDIT: comment's request
We need to dynamically change the reference to the (appropriate cell in the) row 729. To achieve this, we will use this formula:
INDIRECT( hardcoded column & ROW( top-left cell of the vehicle list ) - 1 + MATCH( cell with the kind of the given vehicle , vehicle list , 0 ))
which we will adapt for each cell needed:
so we will be able to substitute them accordingly and obtain this:
Second edit
I've re-written the formula tuning it for the new request. Try it:
Here a table to make the range change easier:
Crazy formulas calls for crazy way to edit.