SUMIFS使用逗号分隔的字符串作为参数

时间:2018-07-19 22:16:41

标签: excel

我有一个看起来像这样的SUMIFS

        <div class="col-sm-12 col-md-4">
            <div class="single-item res-sm text-center moreCards" data-uri="steam-card">
                <div class="single-item-icon">
                    <a href="https://steam.com" class="unstyled-button" style="border:none;background-color:F1F1F1;"><i class="zmdi zmdi-steam animated infinite pulse zmdi-hc-fw"></i></a>
                </div>
                <h4 class="ht-pt">Steam</h4>
            </div>
        </div>

我想运行一个查询,将单元格“ A2”的值设置为:

followedPostsArray

然后在我的公式中引用A2,例如:

followPost() {
    // reset the array
    this.followedPostsArray = [];

     // only then call the service
     this.postService.getFollowedPosts(...);
}

这可能吗?

1 个答案:

答案 0 :(得分:0)

如果员工编号始终为5位数字,则可以使用:

=SUMPRODUCT(SUMIFS('EMPLOYEES'!J:J,'Collections Test'!B:B,AE15,'EMPLOYEES'!F:F,MID(A2,ROW(INDIRECT("1:"&(LEN(A2)+1)/8))*8-6,5),'EMPLOYEES'!C:C,"STAFF"))

如果员工人数并非总是5位数字,那会更加复杂:

=SUMPRODUCT(SUMIFS('EMPLOYEES'!J:J,'Collections Test'!B:B,AE15,'EMPLOYEES'!F:F,MID(A2,SMALL(IFERROR(IF(MID(A2,ROW(INDIRECT("1:"&LEN(A2)+1))-1,1)=",",ROW(INDIRECT("1:"&LEN(A2)))-1),0),ROW(INDIRECT("1:"&LEN(A2)-LEN(SUBSTITUTE(A2,",",""))+1)))+2,SMALL(IFERROR(IF(MID(A2,ROW(INDIRECT("1:"&LEN(A2)+1))-1,1)=",",ROW(INDIRECT("1:"&LEN(A2)))-1),LEN(A2)),ROW(INDIRECT("1:"&LEN(A2)-LEN(SUBSTITUTE(A2,",",""))+1)))-SMALL(IFERROR(IF(MID(A2,ROW(INDIRECT("1:"&LEN(A2)+1))-1,1)=",",ROW(INDIRECT("1:"&LEN(A2)))-1),0),ROW(INDIRECT("1:"&LEN(A2)-LEN(SUBSTITUTE(A2,",",""))+1)))-3),'EMPLOYEES'!C:C,"STAFF"))