excel公式,可基于任何列中的另一个值(txt)对列中的值求和

编程入门 行业动态 更新时间:2024-10-11 11:24:02
本文介绍了excel公式,可基于任何列中的另一个值(txt)对列中的值求和的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我试图写一个If或SumIf来分别计算x,y和z的总和. 我可以使用一个简单的求和公式,但是这些都是成千上万的列,并且x,y和z是随机填充的.我尝试通过对colA进行排序来使用范围,但这是一个临时解决方案,而不是我想要的.

I'm trying to write an If or SumIf to calculate(sum) totals for x , y and z individually. I could use a simple sum formula but these are thousands of columns and x and y and z are populated randomly. I tried using a range by sorting colA but its a temporary solution and not what I am looking for.

我需要类似的东西:

If COL A has 'X' then add values corresponding to X in COL B

示例:

COLA COLB ....... colx x 1 x 2 x 1 y 3 x 3 z 3 x 4

我尝试查找其他类似问题的答案,但找不到适合我的正确答案.

I tried looking up other answers for similar questions but could not find the right one that works for me.

推荐答案

如果要基于单个列中的值对多个列求和,则可以使用SUMPRODUCT这样

If you want to sum multiple columns based on a value in a single column you could use SUMPRODUCT like this

=SUMPRODUCT((A2:A100="x")*B2:X100)

总和范围内不能有文本,B2:X100,否则会出现错误-如果要允许该范围内的文本,请使用以下版本:

There can't be text in the sum range, B2:X100, otherwise you get an error - if you want to allow text in that range use this version:

=SUMPRODUCT((A2:A100="x")*ISNUMBER(B2:X100),B2:X100)

更多推荐

excel公式,可基于任何列中的另一个值(txt)对列中的值求和

本文发布于:2023-11-22 04:47:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1616034.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:公式   excel   txt

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!