View Single Post
  #18   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave Thomas Dave Thomas is offline
external usenet poster
 
Posts: 146
Default My Final #DIV/0! that I'd like to say Goodbye to!

A well designed formula implementation would not do the COUNT(DATA) twice.
It would be smart enough to use the result from the first COUNT(DATA).

"Harlan Grove" wrote in message
...
Dave Thomas" wrote...
We can put this whole issue to rest with:

=IF(COUNT(DATA)+COUNTBLANK(DATA)=ROWS(DATA),
IF(COUNT(DATA),AVERAGE(DATA),""),
"Houston, we have a problem")


You could if you want to call COUNT twice. Wasteful if DATA is large.

Actually, using COUNTIF as first condition is suboptimal because it'd
count all problem cells rather than stopping at the first one. Better to
return error messages ASAP.

=IF(COUNT(MATCH("?*",DATA,0)),"invalid entries",
IF(COUNT(DATA),AVERAGE(DATA),""))