# Double counting based on COUNTIFS with OR statement

1. ## Double counting based on COUNTIFS with OR statement

Hello people:

I have been using this formula to count agents based on time frames which includes OR function: Example:

=IF(COUNTIFS(AR:AR,"<="&TIME(8,0,0),AO:AO,\$AO\$2:\$AO\$10) + COUNTIFS(AQ:AQ,"<="&TIME(8,0,0),AR:AR,"online",AO:AO,\$AO\$2:AO\$10),"1","0")

(AO Column) includes the agents that have Logged Out at specific Times (Column AR) or if Agents are "Online" (not logged out) (Column AR) as well .

AO2 is where first agent is listed , although it is not necessary to have each agent's name on time frame count. The most important result is to have a general count of agents for each time frame.

It works for each row, it gives "1" value if countifs operations results positive for at least 1 of the variables, either logged in or logged at specific time frame.

The only issue I have not been able to figure out is how to tell Excel not to duplicate agents names for each time frame, in example formula all agents are listed on column AO:AO, and for example if Agent X is listed 10 times on such time frame, then excel counts Agent "Paul" 10 times on rows with a 1, that would mean agent was working on such time frame.

That is fine but I would like to know if Excel can interpret that there is only 1 Agent named Paul for each time frame.

Is there a way to avoid multiple counting for each agent?

Thanks very much!!

2. ## Re: Double counting based on COUNTIFS with OR statement

Post a sample worksheet or some sample data.

3. ## Re: Double counting based on COUNTIFS with OR statement

Originally Posted by Jakobshavn
Post a sample worksheet or some sample data.
Jakobshavn thanks, I have made some progress but I do not see the option to attach a file not sure why! Here is the updated formula:

=IF(COUNTIFS(AR:AR,"<="&TIME(8,0,0),AO:AO,\$AO\$2:\$AO\$10) + COUNTIFS(AQ:AQ,"<="&TIME(8,0,0),AR:AR,"online",AO:AO,\$AO\$2:AO\$10),"1","0")

It works for each row, it gives "1" value if countif operation results positive for at least 1 of the variables, either logged in or logged at specific time frame.

The only issue I have not been able to figure out is how to tell Excel not to duplicate agents names for each time frame, in example formula all agents are listed on column AO:AO, and for example if Agent X is listed 10 times on such time frame, then excel counts Agent "Paul" 10 times on rows with a 1, that would mean agent was working on such time frame.

That is fine but I would like to know if Excel can interpret that there is only 1 Agent named Paul for each time frame.

The real purpose is to just count how many agents worked during a specific time frame (that met either 1 of the countifs criterias)

Thanks very much!!

4. ## Re: Double counting based on COUNTIFS with OR statement

Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

Click on GO ADVANCED and use the paperclip icon to open the upload window.

View Pic

5. ## Re: Double counting based on COUNTIFS with OR statement

Originally Posted by martindwilson
Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

Click on GO ADVANCED and use the paperclip icon to open the upload window.

View Pic
Thanks for your help as well, attached is the sample worksheet. Thanks for the instructions!

The important thing here is to count the total agents that worked on a time frame, without duplicating agents due that sometimes they log multiple times during time frames. It is not necessary to least all agent names, but that is the only way I have been able to make some progress

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1