09-17-2019 03:30 AM
09-17-2019 03:30 AM
So I'm trying to get a value into the column "Cat A Tied" (C column). This value depends on the number in the "# People Tied With" column (D Column). In this case, cell D2 has the number 3 in it. I want the sum of the first three rows of the B column (not including column headers) and then divide that by 3. However, I want the cell to be dynamic so if I change the number to 5 it will then automatically take the sum of the first 5 rows and divide by 5. Additionally, if I put this value into D3, the second row of my table, I'd want the first number (3 or 5, or any number put in) of rows from that same row onwards instead of from the first row of the data set.
Any help would be greatly appreciated
09-17-2019 04:22 AM
Please try this and let me know if this is what you are trying to achieve.
and then copy it down.
09-17-2019 04:40 AM
@Subodh_Tiwari_sktneerYes that's brilliant! Thanks so much!
Would you mind explaining how it works please, as I like to learn these things for future use?
09-17-2019 04:43 AM
The only change needed is to divide that SUM value by the value in cell D2. But thank you so much for your help!
09-17-2019 05:29 AM
It seems I missed the division part but that was easy to fix and glad you did it right.
The range passed to the SUM function is derived with the help of OFFSET function in which the anchor cell is $B$1 (which is absolute reference and will always be the same when you copy the formula down) and the row is offset by ROW(D2)-1 which returns the first cell in the sum range i.e. if the formula is placed in the second row, ROW(D2)-1 will return 1 and hence the first cell in the sum range would be one row offset from the anchor cell B1 which would be cell C1 (if you wish you may remove the D2 from ROW(D2) and make it just ROW() and it will work in the same way) and then the height is determined by the number in the D2, If you evaluate the formula in D2, it would be easy for you to know how this formula works.
If that takes care of your original question, please accept the post with the proposed solution as a Best Answer/Response to mark your question as Solved.
09-17-2019 02:15 PM