Forum Discussion
summing a variable number of cells based on a number in another cell
- Feb 08, 2023
=SUM(INDEX(J2:Q2,1):INDEX(J2:Q2,R2))/R2
That got me the correct results and I added the divide worked great, now I want to add 1 additional condition
=If I2>2,SUM(INDEX(J2:Q2,1):INDEX(J2:Q2,R2))/R2,c2
In the above I want to make the sum conditional if i2 is greater than 2 and if not I want to use the value in c2. I am not an expert and your help is greatly appreciated. this is for our golf league and calculating our league handicaps!!
=SUM(INDEX(A1:F1,1):INDEX(A1:F1,H1))An alternative could be this formula where the variable is in cell H1.
- Carlos MonssenFeb 08, 2023Copper Contributor
=SUM(INDEX(J2:Q2,1):INDEX(J2:Q2,R2))/R2
That got me the correct results and I added the divide worked great, now I want to add 1 additional condition
=If I2>2,SUM(INDEX(J2:Q2,1):INDEX(J2:Q2,R2))/R2,c2
In the above I want to make the sum conditional if i2 is greater than 2 and if not I want to use the value in c2. I am not an expert and your help is greatly appreciated. this is for our golf league and calculating our league handicaps!!
- OliverScheurichFeb 08, 2023Gold Contributor
- Carlos MonssenFeb 09, 2023Copper ContributorThat worked perfectly, I owe you big time, Thanks for all your help