Thread: Nested Funtions
View Single Post
  #4   Report Post  
Harlan Grove
 
Posts: n/a
Default

Bob Phillips wrote...
=IF(COUNT(OFFSET($B18,-4,0,-6,1))=6,IF(NOT(ISERROR(AVERAGE(OFFSET(C18,-4,0,
-6,1)))),AVERAGE(OFFSET(C18,-4,0,-6,1)),NA()),NA())


Maybe

=IF(AND(COUNT(OFFSET($B18,-4,0,-6,1))=6,COUNT(OFFSET(C18,-4,0,-6,1))),
AVERAGE(OFFSET(C18,-4,0,-6,1)),"N/A")

However, I have a big problem with negative 4th & 5th arguments to
OFFSET. Makes workbooks much harder to maintain than necessary. Better
to write this as

=IF(AND(COUNT(OFFSET($B18,-9,0,6,1))=6,COUNT(OFFSET(C18,-9,0,6,1))),
AVERAGE(OFFSET(C18,-9,0,6,1)),"N/A")

In general,

OFFSET(rng,ro,co,rc,cc)

could be rewritten as

OFFSET(rng,ro+rc-SIGN(rc),co+cc-SIGN(cc),-rc,-cc) .