Excel功能上的小错误(Excel small mistake in function)

编程入门 行业动态 更新时间:2024-10-25 21:18:11
Excel功能上的小错误(Excel small mistake in function)

我的excel中的公式有一个小问题。 我得到了一个很长的列表,其中包含来自不同人的ID,编号从1到20535,我想要计算投资组合的回报。 一个ID有多行,因此ID会在多行中重复,具体取决于其投资数量。

这是公式 (它除了粗体外它的工作正常)

= IF( B3 = 1 ; SUMIF($ B $ 2:$ B $ 357553; V3; $ D $ 2:$ D $ 357553); B4 = B3 + 1)+ IF( B3 = 1 ; SUMIF($ G $ 2:$ G $ 187396) ; V3; $ I $ 2:$ I $ 187396); B4 = B3 + 1)+ IF( B3 = 1 ; SUMIF($ M $ 2:$ M $ 544950; V3; $ O $ 2:$ O $ 544950); B4 = B3 + 1)+ IF( B3 = 1 ; SUMIF($ R $ 2:$ R $ 131523; V3; $ T $ 2:$ T $ 131523); B4 = B3 + 1)

唯一的错误是粗体部分。 一旦我到达第二个人(所以第二个ID),它就会停止,因为不再满足条件。 我如何让它超越第一个人? 所以直到ID 20535。

提前致谢!

I'm having a small problem with my formula in excel. I got a long list with IDs from different people numbered from 1 to 20535 for which I want to calculate the portfolio return. One ID has multiple lines so the ID is repeated over multiple lines depending on their number of investments.

This is the formula (it's working perfectly except for the bold)

=IF(B3=1;SUMIF($B$2:$B$357553;V3;$D$2:$D$357553);B4=B3+1)+IF(B3=1;SUMIF($G$2:$G$187396;V3;$I$2:$I$187396);B4=B3+1)+IF(B3=1;SUMIF($M$2:$M$544950;V3;$O$2:$O$544950);B4=B3+1)+IF(B3=1;SUMIF($R$2:$R$131523;V3;$T$2:$T$131523);B4=B3+1)

The only mistake is the part in bold. Once I get to the second person (so the second ID) it stops as the condition is not met anymore. How can I make it run past the first person? So untill ID 20535.

Thanks in advance!

最满意答案

由于您每次只需要IF的TRUE部分,只需删除IF并使用SUMIF :

=SUMIF($B$2:$B$357553;V2;$D$2:$D$357553)+SUMIF($G$2:$G$187396;V2;$I$2:$I$187396‌​)+SUMIF($M$2:$M$544950;V2;$O$2:$O$544950)+SUMIF($R$2:$R$131523;V2;$T$2:$T$131523)‌​

将上面的内容放在第2行并复制下来。 应该这样做。

Since you just want the TRUE part of the IF each time, just remove the IF and use the SUMIFs:

=SUMIF($B$2:$B$357553;V2;$D$2:$D$357553)+SUMIF($G$2:$G$187396;V2;$I$2:$I$187396‌​)+SUMIF($M$2:$M$544950;V2;$O$2:$O$544950)+SUMIF($R$2:$R$131523;V2;$T$2:$T$131523)‌​

Put the above in row 2 and copy down. That should do it.

更多推荐

本文发布于:2023-08-04 18:01:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1420913.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   功能   Excel   function   mistake

发布评论

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

>www.elefans.com

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