Excel Counifs-添加简单条件但不起作用

时间:2019-06-10 15:36:32

标签: excel

我有一个简单的countifs,它计算两个日期之间的未清项目,现在我想添加另一个条件,但是不起作用。两种代码都可以作为独立代码使用,但是结合使用时会出错。

import pandas as pd

data = pd.read_excel("file")

new_map = {'Oct':data.Oct,'Aug':data.Aug,'Dec':data.Dec,'Nov':data.Nov}

data['new'] = data.Month.map(new_map)

我的公式是计算未结State IssueDate Due/Closed Date De Date Number Number (A B C) only Closed 12/12/2014 28/04/2015 DD 28/04/2015 1.00 Closed 11/01/2019 04/03/2019 DD 04/03/2019 1.00 Closed 05/01/2019 15/01/2019 DD 15/01/2019 2.00 Closed 06/07/2016 28/10/2016 DD 28/10/2016 1.00 Closed 20/10/2018 24/10/2018 DD 24/10/2018 1.00 Closed 25/09/2016 27/09/2016 DD 27/09/2016 2.00 Closed 24/07/2016 25/07/2016 DD 25/07/2016 3.00 Closed 13/07/2018 22/07/2018 DD 22/07/2018 1.00 Closed 05/07/2016 22/08/2016 A 22/08/2016 2.00 Closed 02/04/2016 12/05/2016 B 12/05/2016 2.00 Closed 14/07/2017 31/07/2017 C 31/07/2017 1.00 Closed 03/05/2016 20/05/2016 DD 20/05/2016 1.00 Closed 11/05/2017 18/05/2017 D 18/05/2017 1.00 Open 09/06/2019 07/10/2019 XXX 07/10/2019 2.00 的数量,而我尝试添加'=COUNTIFS($B$2:$B$50000,"<="&F2,$C$2:$C$50000,">="&F2) + COUNTIFS(A:A, "Open",C:C, "<="&F2)'。我只是不能结合起来。如果我知道如何添加A,我也会同时添加B和C。

任何想法我在做什么错了。

1 个答案:

答案 0 :(得分:0)

在H1中放入“ A”,然后将条件添加到原始公式中:

=COUNTIFS($B$2:$B$50000,"<="&F2,$C$2:$C$50000,">="&F2,F:F, "="&$H$1) + COUNTIFS(A:A, "Open",C:C, "<="&F2,F:F, "="&$H$1)