简体   繁体   中英

Count Unique Values with Conditions Excel

I'm trying to create a simple chart to show how many employees are on a given corrective action level within a specified date range. The issue I'm running into is this:

The log shows associate Test 1 received a verbal warning on 8/14/19 for their productivity, then a first written warning on 8/24/19, then a final written warning that was processed later but took place on 8/23/19.

The formula I wrote will show this as 1 person at each level of correction (verbal, first written, and final written). I want it to only count the highest-level warning for each person. So the chart would only count 1 entry at the final written warning level.

What am I missing to accomplish this?

Raw Data:

在此处输入图片说明

Summary Chart:

在此处输入图片说明

Summary Chart Formula (across from Verbal level):

={SUM(--(FREQUENCY(IF(('2019'!$C:$C<>"")*('2019'!$F:$F=$B$2)*('2019'!$D:$D>=$B$3)*('2019'!$D:$D<=$C$3)*('2019'!$E:$E=$B5)*('2019'!$E:$E<>$B6),MATCH('2019'!$C:$C,'2019'!$C:$C,0)),ROW('2019'!$C:$C)-ROW('2019'!$C$2)+1)>0))}''''

Cracked it! I added two helper columns to the raw data in between Step and Reason.

The first, Level, is a VLOOKUP that converts the Step to a numerical value (in order of severity, the lowest being a Verbal, highest being an Exit).

The second, Max, is a MAXIFS formula to flag which step is the highest severity by associate ID and Reason:

=IF(MAXIFS(F:F,C:C,C2,H:H,H2,D:D,">="&Summary!$B$3,D:D,"<="&Summary!$C$3)=F2,"X","")

在此处输入图片说明

The formula in the summary chart now reads as follows:

=SUM(--(FREQUENCY(IF(('2019'!$C:$C<>"")*('2019'!$I:$I=$B$2)*('2019'!$D:$D>=$B$3)*('2019'!$D:$D<=$C$3)*('2019'!$F:$F=$B5)*('2019'!$H:$H="X"),MATCH('2019'!$C:$C,'2019'!$C:$C,0)),ROW('2019'!$C:$C)-ROW('2019'!$C$1)+1)>0))

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