Formula doesn't continue when new row to table is added

kctony

New Member
Joined
Apr 14, 2017
Messages
25
Office Version
  1. 365
Platform
  1. Windows
I have a running inventory table with a formula that either adds or subtracts and calculates a current balance. When I add a new row either manually or by the use of a form, a row will generate but the formula won't function and I get a #REF .
Any thoughts?
I've looked for many solutions but nothing seems to address my situation.
Thanx

below is the formula... I can't past or insert the table in here...

=IF(AND($F7<>"",$G7<>""),($G7+$J6),IF(AND($F7<>"",$G7=""),($J6-$I7)))
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Maybe INDIRECT?

INDIRECT("F7") will always reference cell F7 regardless of whether new rows/columns are inserted...
 
Upvote 0
Thank you for the response but I don't want it to reference f7.
the table will have new data (rows) added multiple times a day. I want the table to grow with each row and have the formula in the previous row move to the mnew row and calculate based on the input in that row.. I tried to use dynamic ranges but sometimes i would get a reference but most times no, so I went with cell references
 
Upvote 0
Let me see if I understand:

It sounds like you have the formula:

Code:
=IF(AND($F7<>"",$G7<>""),($G7+$J6),IF(AND($F7<>"",$G7=""),($J6-$I7)))

in some cell. If you insert a new line between row 6 and 7, that formula updates to

Code:
=IF(AND($F8<>"",$G8<>""),($G8+$J6),IF(AND($F8<>"",$G8=""),($J6-$I8)))

but you don't want it to. Instead, you want the 6s in that formula to update to 7s so that it always references the current row and the row immediately above it.

Is that what you mean?

If so, INDIRECT truly is the way to go. Instead of referencing cells in a row above, use INDIRECT to offset the row by -1.

Code:
=IF(AND($F7<>"",$G7<>""),($G7+INDIRECT("J"&row(G7)-1)),IF(AND($F7<>"",$G7=""),(INDIRECT("J"&row(G7)-1)-$I7)))
 
Upvote 0
Thank you,
That is a thing of beauty...
I admit I am not too familiar with 'Indirect' and couldn't quite wrap my head around it but that did the trick!.
I was trying INDEX wit not very good results.
Anyway, thank you agian... much appreciated
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,191
Members
452,616
Latest member
intern444

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