Programatically select a subset of a column

Chris Ross
edited 12/09/19 in Formulas and Functions

I want to be able to average, or other function, over a subset of the cells in a row.  The number of cells I want to include is specifiied in a separate cell.


In Excel, I accomplished this with OFFSET.  I read another article here noting that smartsheet doesn't have OFFSET, but that MATCH and INDEX might be able to be used depending on the intent.


Would there be a way to "average N rows" where N is a value in a cell?  Suggestions?


Thank you.


  • Jim Hook
    Jim Hook ✭✭✭✭✭✭

    Chris, that is an interesting problem! I haven't had to do exactly that but I've done something similar. One way to do that is to have another column I will refer to as the "Index" numbered from the top of the area you want to average. Then use a SUMIF or SUMIFS function to sum all the values in rows where the Index is less than or equal to the N and then divide that value by N. That should give you the average of the first N values. A little messy since you have to create another Index column but I think it will work.


Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!