I have a sheet that is supposed to count the number of unique reservations an agent has done. It currently counts duplicates though and I need to only count unique ones.
Here is the formula being used in the sheet:
=SUMPRODUCT((Table_Query_from_db[client_code]=$B7)*(Table_Query_from_db[created_date_time]>=D$1)*(Table_Query_from_db[created_date_time]<D$1+1))
This counts the number of lines/records that show up for a specific person ( $B7
) for a specific date ( D$1
).
Here is the sample of the sheet:
As you can see B7
contains the agents number and D1
contains the date.
Here is the dataset for that specific agent on that specific date:
There is indeed 5 reservations - but only 3 unique ones.
How do I go about getting D7
in the first picture to come out as 3 instead of 5?
Use this array formula:
=SUM(IF((Table_Query_from_db[client_code]=$B7)*(Table_Query_from_db[created_date_time]>=D$1)*(Table_Query_from_db[created_date_time]<D$1+1),1/COUNTIFS(Table_Query_from_db[reservation_number],Table_Query_from_db[reservation_number],Table_Query_from_db[client_code],$B7,Table_Query_from_db[created_date_time],">=" & D$1,Table_Query_from_db[created_date_time],"<" & D$1+1)))
Being an array formula it must be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode. If done correctly then Excel will put {}
around the formula.
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.