Referencing cell one above the current row in a structured table

SanjayGMusafir

Well-known Member
Joined
Sep 7, 2018
Messages
1,507
Office Version
  1. 2024
Platform
  1. Windows
Hi Experts,
Got stuck up with a situation where I want to tell excel to add values in a Column from Header to the row one above current row.

Unable to figure out how to reference a cell above in a structured table.

The formula I'm currently using is -

Excel Formula:
SUMIFS((Banks[[#Headers],[Less]]:[@Less]),(Banks[[#Headers],[Acc]]:[@Acc]),[@Acc],(Banks[[#Headers],[Dt]]:[@Dt]),"<"&[@Dt])

The above works fine.

But want to change the red part below from the above formula to get the desired result

(Banks[[#Headers],[Less]]:[@Less])

Please help.

Thanks a lot
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
See if this example is the sort of thing you want.

SanjayGulatiMusafi.xlsm
IJ
3AmtSum
450
565
6311
7214
8416
Sheet1
Cell Formulas
RangeFormula
J4:J8J4=SUM(INDEX([Amt],1):[@Amt])-[@Amt]
I think I got the idea, let me try what you want to suggest and I Revert back. At times, we complicate things and don't look at the easier side of things.

Thanks again, I just revert back
 
Upvote 0
It did the magic -

I used your concept this way, as the blank cell were causing Value Error

Excel Formula:
=SUMIFS((Banks[[#Headers],[Less]]:[@Less]),(Banks[[#Headers],[Acc]]:[@Acc]),[@Acc],(Banks[[#Headers],[Dt]]:[@Dt]),"<="&[@Dt])-IFS([@Less]="",0,TRUE,[@Less])
 
Upvote 0
If you are not doing it across thousands of rows and not adverse to using offset then this works:
Excel Formula:
(Banks[[#Headers],[Less]]:offset([@Less],-1,0))
 
Upvote 0
If you are not doing it across thousands of rows and not adverse to using offset then this works:
Excel Formula:
(Banks[[#Headers],[Less]]:offset([@Less],-1,0))
Alex I started with this only, but it was giving error, as offset formula returns value of the cell
 
Upvote 0
the blank cell were causing Value Error
My guess is that they are not blank but contain a formula returning ""?

This table has your formula in column J and my formula, slightly adjusted to cope with "" cells in column K and both return the same results.

SanjayGulatiMusafi.xlsm
GHIJK
17LessAccDtSanjayPeter
185a300
196b300
203a355
212b366
222a5588
235a388
244a31313
256a31717
26a32323
27a32323
28a32323
Sheet1
Cell Formulas
RangeFormula
J18:J28J18=SUMIFS((Banks[[#Headers],[Less]]:[@Less]),(Banks[[#Headers],[Acc]]:[@Acc]),[@Acc],(Banks[[#Headers],[Dt]]:[@Dt]),"<="&[@Dt])-IFS([@Less]="",0,TRUE,[@Less])
K18:K28K18=SUMIFS(INDEX([Less],1):[@Less],INDEX([Acc],1):[@Acc],[@Acc],INDEX([Dt],1):[@Dt],"<="&[@Dt])-N([@Less])
 
Upvote 0
Solution
Now that I understand your formula a little better, you can do it with offset but it wouldn't be nearly as efficient as Peter's version.

Excel Formula:
=SUMIFS((Banks[[#Headers],[Less]]:OFFSET([@Less],-1,0)),
                 (Banks[[#Headers],[Acc]]:OFFSET([@Acc],-1,0)),[@Acc],
                 (Banks[[#Headers],[Dt]]:OFFSET([@Dt],-1,0)),"<="&[@Dt])
 
Upvote 0
My guess is that they are not blank but contain a formula returning ""?

This table has your formula in column J and my formula, slightly adjusted to cope with "" cells in column K and both return the same results.

SanjayGulatiMusafi.xlsm
GHIJK
17LessAccDtSanjayPeter
185a300
196b300
203a355
212b366
222a5588
235a388
244a31313
256a31717
26a32323
27a32323
28a32323
Sheet1
Cell Formulas
RangeFormula
J18:J28J18=SUMIFS((Banks[[#Headers],[Less]]:[@Less]),(Banks[[#Headers],[Acc]]:[@Acc]),[@Acc],(Banks[[#Headers],[Dt]]:[@Dt]),"<="&[@Dt])-IFS([@Less]="",0,TRUE,[@Less])
K18:K28K18=SUMIFS(INDEX([Less],1):[@Less],INDEX([Acc],1):[@Acc],[@Acc],INDEX([Dt],1):[@Dt],"<="&[@Dt])-N([@Less])
Sorry Peter for the late response, I was not well. Just now I tried it. It's shorter than my version and delivers the intended result.

And the cells that were giving error was due to pasted blank values there. Once I cleared the cells, error was gone.

Thanks a lot for your effort & patience.
 
Upvote 0
Now that I understand your formula a little better, you can do it with offset but it wouldn't be nearly as efficient as Peter's version.

Excel Formula:
=SUMIFS((Banks[[#Headers],[Less]]:OFFSET([@Less],-1,0)),
                 (Banks[[#Headers],[Acc]]:OFFSET([@Acc],-1,0)),[@Acc],
                 (Banks[[#Headers],[Dt]]:OFFSET([@Dt],-1,0)),"<="&[@Dt])
Alex sorry for the late response, I was not well.

I just try and revert on it, though got a much shorter formula from Peter.
 
Upvote 0

Forum statistics

Threads
1,224,737
Messages
6,180,657
Members
452,992
Latest member
TokugawaIesuma

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