Cross tab query

D

DKS

I have a worksheet with 2 columns.

First column contains a date (several duplicates possible, even in hundreds).

Second column contains a code (4 or 5 different values).

Duplicates possible for first column + second column combination. For
example, for a given date, many records possible with same code value.

How could I write a formula to give me per code value the "unique" number of
dates found between 2 given date values. Meaning, as parameter I can pass
three arguments viz.
code value
start date value
end date value

In return I want the number of unique dates (including start and end date)
to be returned.

All help appreciated.
 
T

Teethless mama

Criterias
In D1: holds code value
In D2: holds start date
In D3: holds end date

=SUM(N(FREQUENCY(IF((Code=D1)*(Date>=D2)*(Date<=D3),Date),Date)>0))

ctrl+shift+enter, not just enter
 
D

DKS

I did not understand the last 2 "Date" parameters. What does that refer to?
Should it refer to the column that contains all the dates?
 
D

DKS

Yes, it is the column. I tried it out and it gives the correct results.
Thanks for your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top