简体   繁体   English

根据条件总结细胞

[英]Sum up cells based on conditions

I appreciate this could be treated as a simple question. 我很高兴将此视为一个简单的问题。 I have been trying to figure out where I'm going wrong as I'm sure it is something simple ... from the Strategy Exposures tab you can see that his strategies are either macro or tactical I have a table (below) and have been asked to to sum up the required exposure for Macro and for Tactical depending on what is there. 我一直在尝试找出问题所在,因为我敢肯定这很简单...从“策略暴露”选项卡中,您可以看到他的策略是宏观策略还是战术策略,我有一张桌子(下)并且有被要求总结宏观和战术所需的曝光量,具体取决于其中的内容。 I want to create two separate cells. 我想创建两个单独的单元格。 One which adds up 'Macro', and the other which adds up 'tactical'. 一个加起来是“宏”,另一个加起来是“战术”。

Strategy    ExposureDescription ExposureRequired (USD)
EUR_MACRO       DAX INDEX        2,000,000
EUR_MACRO       FTSE INDEX       4,000,000
EUR_MACRO       CAC40 INDEX      1,100,000
EUR_MACRO       S&P INDEX       10,000,000
JPY_MACRO       NKY INDEX        4,000,000
JPY_MACRO       S&P INDEX       34,000,000
USD_TACTICAL    S&P INDEX        4,000,000
JPY_TACTICAL    NKY INDEX        6,000,000
JPY_MACRO       S&P INDEX        3,000,000

Currently, I have tried variations of: =SUMIF(B$3:B$11,"*MACRO*",D$3:D$11) however this formula keeps giving an output of 0 . 当前,我尝试了以下形式的变体: =SUMIF(B$3:B$11,"*MACRO*",D$3:D$11)但是此公式始终给出0的输出。 Table ranges from (diagonally) B2 - D11. 表的范围是(对角线)B2-D11。

So it turns out after all of this, the SumIF function was working okay when we created a new workbook with brand new data. 事实证明,在所有这些之后,当我们使用全新的数据创建新的工作簿时,SumIF函数就可以正常工作了。 This prompted me to close down the current sheet which I was having formula issues with, disable the macros and re-try. 这促使我关闭当前遇到公式问题的工作表,禁用宏并重试。 It worked a charm. 它的魅力。 I have never experienced this before however as @brucewayne suggested, their must've been some conflict based on one of the macros. 我以前从未经历过,但是正如@brucewayne所建议的那样,它们一定是基于宏之一的某些冲突。 Unsure what yet, will look into this and see if I can figure it out. 不确定什么,将对此进行调查,看看是否可以解决。 If I do will post more. 如果我愿意,将会发布更多。 Hope this helps someone. 希望这对某人有帮助。

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

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