View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
vezerid
 
Posts: n/a
Default counting number of times value is greater than previous week

I am not so sure about your layout, are your weeks are extending
horizontally or vertically?
Anyway, I tried the following formula in a single column of numbers, in
cells A1:A17. Next to them I supplied formulas in B2:B17. This formula
computes, next to any cell of the source data, the number of weeks with
downward trend, including the current week.

This is an array formula, thus it must be entered with
Shift+Ctrl+Enter. To be entered in B2.
=ROW()-MAX(ROW($B$2:B2)*($A$2:A2$A$1:A1))

You will have to change to < for upward trend. You might need to
add/subtract a constant, if your data do not start in row 1. You might
want to change all instances of ROW() to COLUMN() if time extends along
the horizontal. A more robust formula can be probably built, but at the
time this is the best I can come up with.

HTH
Kostis Vezerides