Forum Discussion

Pointviewman's avatar
Pointviewman
Copper Contributor
Aug 22, 2022

Macro without hard coding data rows

This might be a basic question...

I want to record a macro using Excel on mac ver 16.64.  The calculations are simple.  E.g.: the average of column C.  The challenge is that on some data files i have 100 rows of data and on others 500+ rows.  How can i make the same macro work for all cases...100 rows for 1000 rows and everything in between.

Thanks in advance

  • Pointviewman 

    The AVERAGE function ignores empty cells, so you could use the largest range you expect.

    If you want to use the exact range we'd have to know in detail what you want to do.

    • Pointviewman's avatar
      Pointviewman
      Copper Contributor
      Thanks Hans.
      Average function was a bad example. I use countifs and other functions too. Basic problem is that the range can be different in different files. How best to handle that?

Resources