Count unique values with multiple criteria

awalt

New Member
Joined
Aug 18, 2016
Messages
8
I am looking to count something specific, using multiple criteria, however I cannot use the COUNTIF function due to the way my workbooks are linked.

The goal is to count how many unique PARTY ID's fall within a given date range. I thought I had this working using the below formula, but it's not getting all the data. My goal is to count how many rooms I have per date range (unique party ID = room)

{=SUM(--(FREQUENCY(IF((criteria1)*(criteria2),values),values)>0))}

The party ID's should line up directly with the dates listed, however I believe the reason it is not capturing the data is because the PARTY IDs start 2 rows higher than my date ranges on sheet 2. I am not able to change how the sheets are laid out to make the PARTY ID start on the same line, but I can't figure out how to get this to calculate correctly. Below are some screen shots of what my data looks like.

Any help would be appreciated!

https://drive.google.com/file/d/1vnl2lH3mv_bZ4k1tTBkILbMdcHa2uwEa/view?usp=sharing
=SUM(--(FREQUENCY(IF((Sheet1!A:A="2019-12-12")*(Sheet1!B:B="2019-12-16"),Sheet2!A:A),Sheet2!A:A)>0))


https://drive.google.com/file/d/15f3YFngmLQY6qnYji3rtpr_wbZ1GzfDT/view?usp=sharing
https://drive.google.com/file/d/1idJh_pk9-DdU_Q2lwsW-TnF5Q-Oay4b-/view?usp=sharing
https://drive.google.com/file/d/1EUM2ZSI1u-CUOABy9RJQI-LPB1JyiCci/view?usp=sharing
 

ExcelElliott

New Member
Joined
Mar 1, 2018
Messages
40
Not sure if this will work, but try

= SUM(--(FREQUENCY(IF(Sheet1!A:A = "2019-12-12",IF(Sheet1!B:B = "2019-12-16",Sheet2!A:A)),Sheet2!A:A>0)))
 

ExcelElliott

New Member
Joined
Mar 1, 2018
Messages
40
Also I just noticed that when I did it on my computer I had the dates in other cells, i.e. in your photo maybe put the start date in row 4 and the end date in row 5, and then reference them in the formula

= SUM(--(FREQUENCY(IF(Sheet1!A:A = Sheet2!A4,IF(Sheet1!B:B = Sheet2!A5,Sheet2!A:A)),Sheet2!A:A>0)))

I tried typing in the dates in the formula as you have them and it did not work but did using the modification I mentioned above.
 

awalt

New Member
Joined
Aug 18, 2016
Messages
8
Hi,

So sorry for the late reply! I tried the formula as you suggest above, which is counting the amount of time that date range appears in the list, but not limiting it based on the party ID on sheet 2. I am referencing my dates in sheet 4 as you suggested.

For example the date range 12/11/19 - 12/16/19 the count should be 4 since there are 4 party ID's with that date range, but the formula is returning 14, the # of times that date range appears in the dates sheet on sheet 1.

=SUM(--(FREQUENCY(IF(Sheet1!A:A=Sheet4!A2,IF(Sheet1!B:B=Sheet4!A7,Sheet2!A:A)),Sheet2!A:A>0)))
 

Forum statistics

Threads
1,078,520
Messages
5,340,922
Members
399,399
Latest member
SravanaSandhya

Some videos you may like

This Week's Hot Topics

  • Problem with Radio Button's format control
    I am creating an employee evaluation template (a sample is below) Column A is the category Column B, C D, E and F will be ratings (unacceptable...
  • Last Display on userform to a Listbox
    [CODE=vba] lstdisplay.ColumnCount = 15 lstdisplay.RowSource = "A1:O600000" [/CODE] So when i do this it Displays everything on the sheet i am...
  • Rename and move files to a new location
    Dear all, I have an excel file with the following information. The actual file name is at column A but i want to rename it using the following...
  • Help with True/False Formula
    Hello! Am stumped how to fix this formula, in which my result returns 'True', but it should return False. =IF(AG2=True...
  • Clear extra characters from a provided range of cells
    Dear All, I have following code which gives me desired output to remove extra characters from a provided range. But it takes too much time when...
  • Help with Current and highest streaks
    Hi there, I've just joined the forum and this is my first post. I've already spent quite a bit of time searching the net and this forum for a...
Top