How to modify this following formula so duplicates are counted once?
=COUNTIFS(Assignment,">"&0,plant,"="&C54,posting_date,">="&'Months & Dates'!$C$7,posting_date,"<="&'Months & Dates'!$D$7)
Thanks for your help.
How to modify this following formula so duplicates are counted once?
=COUNTIFS(Assignment,">"&0,plant,"="&C54,posting_date,">="&'Months & Dates'!$C$7,posting_date,"<="&'Months & Dates'!$D$7)
Thanks for your help.
It's difficult to place in context without a work example.
What are you trying to do with Count, if not count the duplicates? Are you trying to exclude duplicate rows that have all the same data?
Hi,
Duplicates across which of your criteria? All of them? Assignment only? plant only? Assignment and plant only?
Please try to offer as much information as you can (better still, post a workbook so that forum readers do not have to go to the trouble of artificially constructing data in which to test their potential solutions).
Regards
Here's my best guess...
You want to count the unique plants that meet the conditions.
Try this array formula**:
=SUM(IF(FREQUENCY(IF(Assignment>0,IF(Plant=C54,IF(Posting_Date>='Months & Dates'!$C$7,IF(Posting_Date<='Months & Dates'!$D$7,MATCH(Plant,Plant,0))))),ROW(Plant)-MIN(ROW(Plant))+1),1))
** array formulas need to be entered using the key
combination of CTRL,SHIFT,ENTER (not just ENTER).
Hold down both the CTRL key and the SHIFT key
then hit ENTER.
Biff
Microsoft MVP Excel
Keep It Simple Stupid
Let's Go Pens. We Want The Cup.
I am providing a sample data, so you can better help me out.
On the tab "Cal", the number of assignments (which are shown on the tab "Data") needs to be counted (calculated).
Multiple occurrences should be considered once. The posting date should be taken into consideration. "61 to 90 days" refers to the month of May (more info on the 1st tab).
Please let me know if you have any questions.
Thanks
sample_data.xlsx
If D5 = >90 days then what is the date range? On the Months and Dates sheet there is no beginning date for >90 days.
Also, it would be a good idea to show us what results you expect.
Tony,
Please consider the month of May for the calculation. The number of assignment is 1 for each plant (DFSA, DSEC and STDS) based on my manual calculation.
Try this...
On the Months and Dates sheet...
Fill in a beginning date for >90 days. I used 4/1/2013.
In cell A7 there is an extra space character after the 61 in the string: 61 to 90 days. Remove that extra space character.
On the Cal sheet enter this array formula** in D7:
=SUM(IF(FREQUENCY(IF(Data!C$5:C$16>=VLOOKUP(D$5,'Months & Dates'!A$5:D$8,3,0),IF(Data!C$5:C$16<=VLOOKUP(D$5,'Months & Dates'!A$5:D$8,4,0),IF(Data!D$5:D$16=C7,MATCH(Data!E$5:E$16,Data!E$5:E$16,0)))),ROW(Data!E$5:E$16)-ROW(Data!E$5)+1),1))
** array formulas need to be entered using the key
combination of CTRL,SHIFT,ENTER (not just ENTER).
Hold down both the CTRL key and the SHIFT key
then hit ENTER.
Copy down to D9
See the files bro, give me a feedback if its meet your expectation...
Azumi
Azumi,
You are close to the correct formula. I think FREQUENCY needs to be used to avoid counting the duplicates. Remember that the assignments should be counted once.
Thanks
Works for me.
Here's your file with the formula implemented:
sample_data(1).xlsx
Ok maybe this, with little modification,
=IF(SUMPRODUCT(--(Data!$C$5:$C$16<=$F$5),--(Data!$C$5:$C$16>=Cal!$E$5);--(Data!$D$5:$D$16=Cal!C7))>=1,1)
Same file, other alternative formula (Array Formula):
=SUM(--(FREQUENCY(IF((Data!$D$5:$D$16=Cal!C7)*(Data!$C$5:$C$16>=Cal!$E$5)*(Data!$C$5:$C$16<=Cal!$F$5),MATCH(Data!$E$5:$E$16,Data!$E$5:$E$16)),ROW(Data!$E$5:$E$16)-ROW(Data!$E$5)+1)>0))
then Hit CTRL-SHIFT-ENTER Button Same time....
Azumi
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks