简体   繁体   中英

Excel Pivot table count between

I have a problem creating a pivot table/chart with between date function. I would like to know the total count of projects that are active between two dates. A Chart with on the x-axis week 1 - week 52 is what i'm trying to create.

Example Chart

20
10
5
0

week 1 week 2 week 3 .....

My columns:

Project ID | START WEEK NUMBER| END WEEK NUMBER

What have I already done?

Adding helper columns 1 till 52 with the following function:
=IF(AH$1=MEDIAN($AB10;$AD10);1;IF(AH$1=$AB10;1;IF(AH$1=$AD10;1;"")))

This will show a 1 when the column week header is equal or between date start week and end week. But with this I am still not able to create a chart with the weeks on the x-axis and the total count of that week.

Make a new sheet and in Column A put your weeks 1-52 down. In column B use this formula:

=COUNTIFS(Sheet6!$B$2:$B$18,"<="&A2,Sheet6!$C$2:$C$18,">="&A2)
  1. Sheet6! Needs to be replaced with the name of your Sheet, eg Projects!
  2. Column B range needs to be the entire range of your start week
  3. Column C range needs to be the entire range of your end week
  4. B and C dimensions need to match.

If you need to use a pivot table, try rearranging your source data as shown:

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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