Dynamic Formula to Sum Cells in Row

Gos-C

Active Member
Joined
Apr 11, 2005
Messages
258
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi all,

I have the following formula:

PHP:
{="=SUM(C"&ROW(OFFSET(APR!$J$1,MAX(ROW(APR!$J:$J)*(APR!$J:$J<>""))-12,0))&":N"&ROW(OFFSET(APR!$J$1,MAX(ROW(APR!$J:$J)*(APR!$J:$J<>""))-12,0))&")"}

It returns:

PHP:
=SUM(C408:N408)

But I need it to return the value (i.e, the sum of cells C408 to N408).

Any how?

Thank you,
Gos-C
 
Last edited:

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
I used:

PHP:
{=SUM(INDIRECT("C"&ROW(OFFSET(APR!$J$1,MAX(ROW(APR!$J:$J)*(APR!$J:$J<>""))-12,0))&":N"&ROW(OFFSET(APR!$J$1,MAX(ROW(APR!$J:$J)*(APR!$J:$J<>""))-12,0))&")"))}

But it give the #REF! error.

What have I done wrong?

Gos-C
 
Upvote 0
I got a ref# error when i uploaded your formula, so i thought it was working on your side. If you wrap indirect around your formula, it should have worked i thought anyway.

Maybe there is a better way let me look at your formula
 
Upvote 0
Hi Steve,

I have several similarly formatted reports, which varies in length, and I want to sum a range in the 12th from last row of each report.

Gos-C
 
Upvote 0
Try this:

Hopefully some of the quotes didn't leave the reply

=SUM(INDIRECT(("C"&IF(ISERROR(MATCH(9.999999E+306,J:J)),MATCH("*",J:J,-1),
IF(ISERROR(MATCH("*",J:J,-1)),MATCH(9.999999E+306,J:J),
MAX(MATCH(9.999999E+306,J:J),MATCH("*",J:J,-1))))-12)&":n"&IF(ISERROR(MATCH(9.999999E+306,J:J)),MATCH("*",J:J,-1),
IF(ISERROR(MATCH("*",J:J,-1)),MATCH(9.999999E+306,J:J),
MAX(MATCH(9.999999E+306,J:J),MATCH("*",J:J,-1))))-12))
Last row formula from: http://www.grbps.com/Excel7.pdf

by the way, how do you insert a box to post your formula?
 
Upvote 0
Hi Steve,

It didn't work; I got 0 (zero). BTW, my data is on a different sheet (named APR) in the same workbook.

The cells have the following values:

PHP:
C	D	E	F	G	H	I	J	K	L	M	N
0	66	71	63	135	0	6	0	22	0	35	2
 
Upvote 0
Yes you would get zero if the sheet you put it in was not APR

copy the previous formula and put it in any part of sheet APR but not in column J Then cut and paste it to where you want it.

Alternately, i did a find and replace for you How nice am i :laugh::

=SUM(INDIRECT(("C"&IF(ISERROR(MATCH(9.999999E+306,APR!J:APR!J)),MATCH("*",APR!J:APR!J,-1),
IF(ISERROR(MATCH("*",APR!J:APR!J,-1)),MATCH(9.999999E+306,APR!J:APR!J),
MAX(MATCH(9.999999E+306,APR!J:APR!J),MATCH("*",APR!J:APR!J,-1))))-12)&":n"&IF(ISERROR(MATCH(9.999999E+306,APR!J:APR!J)),MATCH("*",APR!J:APR!J,-1),
IF(ISERROR(MATCH("*",APR!J:APR!J,-1)),MATCH(9.999999E+306,APR!J:APR!J),
MAX(MATCH(9.999999E+306,APR!J:APR!J),MATCH("*",APR!J:APR!J,-1))))-12))
 
Upvote 0

Forum statistics

Threads
1,224,583
Messages
6,179,673
Members
452,937
Latest member
Bhg1984

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top