Excel CountIF formula

How can I modify the attached sheet formula so it counts the number of data points for a given wind direction with zero wind and a wave height greater than zero and output in column P rows 5 to 20.  See the attached ‘table’ sheet and current formula .  Applying a filter to the data table for wind speed of zero I can see that there is 6 inputs which meet the criteria 1x NE and 4 x WSW.  The wave table has been modified to show how looking for outputs to be presented in RED for illustration.

As an add on what formula would allow me to count occurences for ALL directions with wave height greater than zero so output is a single sum of 6 as in this scenario.?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ProfessorJimJamMicrosoft Excel ExpertCommented:
i do not understand the question.

you mentioned modify formula, which formula?
perhaps in the file if you indicate the cell with a demo value where i need to put the formula that can result that demo value.
PVR101Author Commented:
Hi, cell  p7 on table sheet. formula to modify is in cell Q7 (and copied down/up accordingly.  Regards 2nd question the output result sum (eg 6 for my scenario) could be placed in cell p22.

ProfessorJimJamMicrosoft Excel ExpertCommented:
i still do not get it.

you mentioned P row 5 to 20 and now you are referring only to P7 , i am sure that there is a very simple solution to this with countIfs but i do not understand what is needed.
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

Saqib Husain, SyedEngineerCommented:
Use this formula in P5 and copy down and across

=COUNTIFS('Metocean Data'!$E:$E,Table!$O5,'Metocean Data'!$F:$F,Table!P$3)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Saqib Husain, SyedEngineerCommented:
For all directions you can use

=COUNTIFS('Metocean Data'!$F:$F,Table!P$3)
PVR101Author Commented:
Syed, thanks.  

Unfortunately when apply formula to larger data set it also counts data which are invalid and populated with text such as NaN or -999 etc under column h. tweaking your formula to ;

=COUNTIFS('Metocean Data'!$E:$E,Table!$O7,'Metocean Data'!$F:$F,Table!P$3,'Metocean Data'!$H:$H,">0")

=COUNTIFS('Metocean Data'!$F:$F,Table!P$3,'Metocean Data'!$H:$H,">0")

appears to solve this.

as an aside which is more efficient/user friendly from file size/computation etc point of view when selecting ranges 1. specifying exact range (row x to row x) as I did (requires manual updating when add new data) or 2. your option where select entire column/rows??  the latter seems more robust but wonder if might extend unnecessarily file size and calc time?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.