Here is my problem. I need to look at D2:D607 and see if equals DTW.If it does, then I only want to count it if cells H2:H607 are nonblank. I've tried a few ways but they have all had errors with the structure. Please help me get on the right track. Thank you so much in advance for any help you can provide me.
Last edited by NBVC; 03-30-2010 at 12:57 PM.
Hi Koncurn, welcome to the forum.
Try this formula:
=SUMPRODUCT(--(D2:D607="DTW"),--(H2:H607<>""))
Try:
=Sumproduct(--(D2:D607="DTW"),--(H2:H607<>""))
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.
Thank you so much as this worked like a charm. Could you explain what the--in the equation means so that I can learn and help myself more? Thanks again.
The two dashes are called unary operators (double unary in this case). It serves to coerce (convert) the TRUE/FALSE values returned by each condition of the SUMPRODUCT into 1's and 0's in order to perform mathematical calculations on them.
For example, in your formula you'd get something like:
=SUMPRODUCT(--(D2:D607="DTW"),--(H2:H607<>""))
=SUMPRODUCT(--({TRUE;TRUE;FALSE;FALSE...}),--({TRUE;FALSE;FALSE;TRUE;...}))
=SUMPRODUCT({1;1;0;0;...},{1;0;0;1;...})
=18
Hope that makes sense on a basic level. There's many threads discussing/arguing SUMPRODUCT and using double-unary operators vs. multiplication, e.g. (D2:D607="DTW")*(H2:H607<>""), but you can usually use both interchangeably.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks