Hello all,
I have a w/book were i need to count numbers that match a team.
ei i want G4 to show 2,because column C team a matches column B number 4 twice.
Please if anyone can help,see attached w/book.Thanks
Hello all,
I have a w/book were i need to count numbers that match a team.
ei i want G4 to show 2,because column C team a matches column B number 4 twice.
Please if anyone can help,see attached w/book.Thanks
Last edited by dealer; 10-08-2010 at 03:09 AM.
Given use of XL2007
![]()
F4: =COUNTIFS($C$2:$C$11,$E4,$B$2:$B$11,F$3) applied to matrix
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
Thank you,it does the trick.
But for my peace of mind could this be done with a combination of sumif & countif or would i be way off the mark.
I'm afraid not at least not in present form.Originally Posted by dealer
SUMIF & COUNTIF are both constrained in so far as
If you wanted to use COUNTIF you would need to concatenate B & C in to a new column, eg:a) they process on the basis of a single criteria (you have two) [COUNTIFS & SUMPRODUCT can handle multiple criteria]
b) they are not able to adjust the underlying values within the calculation (unlike SUMPRODUCT)
At which point:![]()
D2: =$B2&"@"&$C2 copied down
As mentioned you could avoid the concatenation and COUNTIFS and use SUMPRODUCT, however, SUMPRODUCT is inefficient.![]()
F4: =COUNTIF($D$2:$D$11,F$3&"@"&$E4) copied across matrix
If you can use COUNTIFS you should do so.
If you can't (backwards compatibility) I would advise the concatenation approach.
Implementing Matrices of SUMPRODUCTs is generally speaking a bad habit to get into - if you search the board for "Poor Performance" threads you'll get the idea
As such I rarely advise it.
Thanking you both for the replies.
Please don't pick me up wrong,i am using your countifs formula.
i spent 30 mins trying to use sumif,countif.
and as you pointed out i was taking the wrong approach,i am just trying to understand how different functions work.
if i was to use excel 2003 what then would the right approach be?
since countifs is 2007.use sumproduct then?
You can try this formula.. SUMIF won't work here:
=SUMPRODUCT(--($C$2:$C$11=$E4),--($B$2:$B$11=F$3))
but COUNTIFS is better approach.
Never use Merged Cells in Excel
Yes.
SUMPRODUCT for pre-2007 versions if you don't want extra helper column.
If your workbook is small you can use SUMPRODUCT.
If it's large it will become slow so Donkeyote's approach with helper column is much faster.
Also, you can use a Pivot table.
Thanks again,problem solved.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks