ARRAYFORMULA中的SUMIFS不起作用

时间:2018-04-28 19:14:50

标签: arrays google-sheets range formula sumifs

我正在创建一个销售跟踪器并与SUMIFS ARRAYFORMULA挣扎。

这是公式: -

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>Home Page</title>
    <link rel="stylesheet" href="css/backgroundgrid.css">
    <script src="js/javascript.js"></script>
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Dancing+Script" type='text/css'>


</head>

<body>

    <header>

        <nav>
            <div id="sideNavBar" class="sidenav">

                <a href="javascript:void(0)" class="closebtn" onclick="closeNav()">&times;</a>
                <a href="index.html">Home</a>
                <a href="resume.html">Resume</a>
                <a href="#">Page 2</a>
                <a href="#">Page 3</a>

            </div>

            <!-- Use any element to open the sidenav -->
            <span style="font-size:35px;cursor:pointer;margin-left:.5em;" onclick="openNav()">&#9776; </span>

            <span id="logo">
                <img src="images/logosamuelsmall.png">
            </span>


        </nav>


    </header>

    <main>
        <div>gfdgdf</div>

        <div>
            <div class="card-container">
                <div class="card">
                    <div class="side">
                        <h3 class="heading-banner head-text">Background</h3>
                    </div>

                    <div class="side back">

                        <ul>
                            <li>I'm an aspiring software engineer who loves creating new software that is playful, interactive
                                and has heart. I've lived in lots of different places and have worked in lots of different
                                jobs. I’m excited to work on teams that support, learn, and build the amazing. </li>
                            <li>I've been working with technology, customer support and sales for 10+ years. </li>
                            <li>I love music, cooking and learning</li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>

        <div>gfdgdf</div>

        <div>
            <div class="card-container">
                <div class="card">
                    <div class="side">
                        <h3 class="heading-banner head-text">Background</h3>
                    </div>

                    <div class="side back">

                        <ul>
                            <li>I'm an aspiring software engineer who loves creating new software that is playful, interactive
                                and has heart. I've lived in lots of different places and have worked in lots of different
                                jobs. I’m excited to work on teams that support, learn, and build the amazing. </li>
                            <li>I've been working with technology, customer support and sales for 10+ years. </li>
                            <li>I love music, cooking and learning</li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>


        <div>gfdgdf</div>

        <div>
            <div class="card-container">
                <div class="card">
                    <div class="side">
                        <h3 class="heading-banner head-text">Background</h3>
                    </div>

                    <div class="side back">

                        <ul>
                            <li>I'm an aspiring software engineer who loves creating new software that is playful, interactive
                                and has heart. I've lived in lots of different places and have worked in lots of different
                                jobs. I’m excited to work on teams that support, learn, and build the amazing. </li>
                            <li>I've been working with technology, customer support and sales for 10+ years. </li>
                            <li>I love music, cooking and learning</li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>

    </main>

</body>


</html>

这是我正在查看的列的快照:

  • 表1(“客户销售”):列C =帐号,列G = '前院总计'
  • 表2(“直播!”):列C ='销售价值',列 j =“前院”/“直接”,栏K =帐号

该公式将在第1页的第G栏中进行。我需要它将第2页(C列)的销售价值列汇总为列J中所说“Ex-Yard”的所有行,但仅限于表1列C中的帐号可在表2列K中找到。

它包含敏感数据,因此无法共享,但这是一个示例:https://docs.google.com/spreadsheets/d/1jcZNkg5lI7SFlZw153vNGSjOyGmwr3Q-xEq03AmVkeo/edit?usp=drivesdk

由于

2 个答案:

答案 0 :(得分:0)

公式存在多个问题。

首先,它解决了SUMIFS中的错误列:根据您发布的电子表格,帐号在表2中没有,您可以使链接打开,而不是列A中的客户名称。在修复了寻址之后,当该公式应用于“客户销售”中的单个单元格时!G5将为该客户生成正确的金额:

=if(isblank(C5),"",sumifs('LIVE!'!C$4:C,'LIVE!'!A$4:A,D5,'LIVE!'!J$4:J,"Ex-Yard"))

其次,由于Google已知的原因,ARRAYFORMULA不能很好地处理SUMIFS或其他在第一个参数中处理范围的函数。这么可悲的消息,你不能使用ARRAYFORMULA,而是你需要复制公式(这就是为什么你现在必须使用带有$符号的绝对寻址的原因)。

enter image description here

答案 1 :(得分:0)

如果 ARRAYFORMULA 和 SUMIFS 函数的第一个参数是一个范围,那么 Google 表格确实似乎存在问题,即以下公式将产生不正确的结果(使用@ttarchala 建议的更正):

=ARRAYFORMULA(IF(ISBLANK(C5:C), "", SUMIFS('LIVE!'!C$4:C,'LIVE!'!A$4:A,D5:D,'LIVE!'!J$4:J,"Ex-Yard")))

另一种解决方法,在仍然使用 ARRAYFORMULA 的同时,用 SUMIF 替换 SUMIFS 并连接要比较的两列:

=ARRAYFORMULA(IF(ISBLANK(C5:C), "", SUMIF('LIVE!'!A$4:A&'LIVE!'!J$4:J,D5:D&"Ex-Yard",'LIVE!'!C$4:C)))

现在您不必在工作表中复制公式。