View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions,microsoft.public.excel
Harlan Grove[_2_] Harlan Grove[_2_] is offline
external usenet poster
 
Posts: 1,231
Default How to count the data in ranges for compass points

"WM" <warrenmmmmm @ gmail.com wrote...
....
ranges for compass points...
Something like this:
=countif(v4:v800, "22.5") +? or -? countif(v4:v800, "<67.5") etc would
equal northeast
=countif(v4:v800, "67.5") -? countif(v4:v800, "<112.5") would equal
east....but this is where it goes wrong. One can only apply the second
argument to the range that goes down to the first.


360 degrees in a circle, 8 compass points (because you're only looking at
NE, SE, SW, NW rather than NNE, etc.), 360 / 8 = 45, but points are centered
within their intervals, so +/- 45/2 degrees either side of the points. I'll
use the convention that exact equality on the boundaries always resolves to
major compass points, so exactly 337.5 and 22.5 are both North, exactly 67.5
is East, exactly 292.5 is West, etc.

Use a table. I'll name it Points.

__0.0000__0__N
_22.5001__1__NE
_67.5000__2__E
112.5001__3__SE
157.5000__4__S
202.5001__5__SW
247.5000__6__W
292.5001__7__NW
337.5000__8__N

Then you could use formulas like

=SUMPRODUCT(--(LOOKUP(YourRangeHere,Points)="N"))

If and when you want to expand to 16 points (e.g., NNE), all you'd need to
do would be expand the table. The formulas referring to it could remain
as-is. Their values may change if something that used to be NE became ENE.