# 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.?
CountIf-Table.xlsx
###### Who is Participating?
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.

Commented:
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.
0
Author 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.

thanks.
0
Commented:
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.
0
EngineerCommented:
Use this formula in P5 and copy down and across

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

Experts Exchange Solution brought to you by

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

EngineerCommented:
For all directions you can use

=COUNTIFS('Metocean Data'!\$F:\$F,Table!P\$3)
0
Author 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?
0
###### 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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.