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:
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
It returns:
=SUM(C408:N408)
So, the data in column C is numeric only?

Are there any empty cells within the range of column C?
 
Upvote 0

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hi T. Valko,

No, C4 is text (the column title). And, yes, there are blank cells in column C.

Steve, I had try already tried your suggestions without success - and I did it again with the same result.

Gos-C
 
Upvote 0
I don't think anything is different.

This time i created my own sheet called APR

i then changed each reference to APR.

I added a row in J on APR and it moved and added C:N on APR

by the way, do NOT hit ctrl+Shift+enter. This is NOT an Array. (just in case)

Here is that formula that i just changed and retested:
=SUM(INDIRECT(("C"&IF(ISERROR(MATCH(9.999999E+306,APR!J:J)),MATCH("*",APR!J:J,-1),
IF(ISERROR(MATCH("*",APR!J:J,-1)),MATCH(9.999999E+306,APR!J:J),
MAX(MATCH(9.999999E+306,APR!J:J),MATCH("*",APR!J:J,-1))))-12)&":n"&IF(ISERROR(MATCH(9.999999E+306,APR!J:J)),MATCH("*",APR!J:J,-1),
IF(ISERROR(MATCH("*",APR!J:J,-1)),MATCH(9.999999E+306,APR!J:J),
MAX(MATCH(9.999999E+306,APR!J:J),MATCH("*",APR!J:J,-1))))-12))
 
Upvote 0
Hi T. Valko,

No, C4 is text (the column title). And, yes, there are blank cells in column C.

Steve, I had try already tried your suggestions without success - and I did it again with the same result.

Gos-C
Ok, is this what you're trying to do?

Find the last (bottom most) numeric value in column C. From there, going back up the column a total of 12 rows and then sum from that row in column C to that row in column N.
 
Upvote 0
Ok, let's assume this is your data:

Book1
BCDEFGHIJKLMN
5_19847521227094197376737
6_7846112972133734683176
7_75979010642168398481436
8_409418595425838131928248
9_67703056387489855023620
10125966202821954084523347
1111542051161429447645347591
121027323539917094311234221
13937777873665232432939469
14898373542110856253363284
157511198606867755591277080
1664678127997593761377476
175856389048638899642470
18474986981334125218269056
1938780156565647437386441
20211938432435439567615476
2117593926921424224991878
Sheet1

To get the sum of the row that's highlighted, the 12th from the last row...

=SUM(INDEX(C:N,MATCH(1E100,C:C)-11,0))
 
Upvote 0
Great! Works perfectly!

Thank you very much, T. Valko.

Sincerely,
Gos-C
 
Upvote 0

Forum statistics

Threads
1,224,585
Messages
6,179,704
Members
452,938
Latest member
babeneker

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