Allow me to explain through example:
Here is some sample data:
ID----------GROUP----------STATUS
043----------38---------------Closed
048----------38---------------Open
075----------42---------------Closed
075----------42---------------Closed
088----------53---------------Open
023----------53---------------Closed
015----------53---------------Open
Basically, I only want to retrieve records for a Group if the Group contains at least one Open and at least one Closed for the status column.
I'd be grateful if anyone had any ideas on how to write such a formula.
Last edited by hk106; 01-09-2012 at 01:49 PM.
Assuming your data is in Sheet1, starting with headers at A1...
Then in D2 enter formula:
=IF(AND(COUNTIFS($B$2:$B$8,B2,$C$2:$C$8,"Closed"),COUNTIFS($B$2:$B$8,B2,$C$2:$C$8,"Open")),COUNT($D$ 1:$D1)+1,"")
copied down
and in E2 enter:
=MAX(D:D)
then in Sheet2, A2 use formula to retrieve the relevant info:
=IF(ROWS($A$2:$A2)>Sheet1!$E$2,"",INDEX(Sheet1!A:A,MATCH(ROWS($A$2:$A2),Sheet1!$D:$D)))
copied down and across 3 columns
Microsoft MVP - Excel
Where there is a will there are many ways. Pick One!
Please read the Forum Rules
If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below
Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.
Preferred Charities: Lupus Canada and Sick Kids Foundation.
Feel Free to Donate if you want to, for the assistance you received today.
NBVC, thanks for the response.
After reviewing the recordset, I'm realizing there are more possible values for the STATUS field then just "Open" and "Closed." I am still checking to ensure that there is at least one value with "Open" per Group, but how could I tweak your formula to check to ensure that there is at least one value that is not "Open per Group?
So you want to extract all records if there is at least one status that is not "OPEN"?
If yes, try changing formula in D2 of Sheet1 to:
=IF(COUNTIFS($B$2:$B$8,B2,$C$2:$C$8,"<>Open"),COUNT($D$1:$D1)+1,"")
copied down
Microsoft MVP - Excel
Where there is a will there are many ways. Pick One!
Please read the Forum Rules
If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below
Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.
Preferred Charities: Lupus Canada and Sick Kids Foundation.
Feel Free to Donate if you want to, for the assistance you received today.
Almost. It's both.
I apologize for my lack of clarity. I'm hoping for a formula that will identify the records whose groups contain
a) at least one "Open" record
b) at least one record that is not "Open"
I assume it's a matter of combining the formulas you've provided, I'm just not sure how to construct it.
Thank you for you effort on this.
Then:
=IF(AND(COUNTIFS($B$2:$B$8,B2,$C$2:$C$8,"Open"),COUNTIFS($B$2:$B$8,B2,$C$2:$C$8,"<>Open")), COUNT($D$1:$D1)+1,"")
Microsoft MVP - Excel
Where there is a will there are many ways. Pick One!
Please read the Forum Rules
If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below
Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.
Preferred Charities: Lupus Canada and Sick Kids Foundation.
Feel Free to Donate if you want to, for the assistance you received today.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks