is there a vba function or excel formula to avoid circular reference error?

outlawdevil

Board Regular
Joined
Jun 30, 2009
Messages
238
I am trying to paydown loan balance $2 increment on loan balance of $14 if my checking account is greater than $2. I wanted to paid in full eventually so I keep reducing my loan balance if there is a payment. If I used both If & to validate condition statement in my formula, it runs in to cirular reference. Anyone knows if there is a better way to do this? Please see the attached image for example. Thanks.

1605634853013.png
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
A circular reference is not a formula error, it is a logic error. You need to rethink how you are solving your problem. What are the formulas in column E?
 
Upvote 0
A circular reference is not a formula error, it is a logic error. You need to rethink how you are solving your problem. What are the formulas in column E?
It’s equal to cell B2 and down,I think that’s why it’s creating the circular reference but I do need that in order to check If I have enough money to pay off the loan.
 
Upvote 0
Please see the attached image for example. Thanks.

Contrary to the adage, "a picture is __not__ worth 1000 words", usually. At the very least, you should __tell__ us what all the formulas are. Even better, use the XL2BB add-in to copy-and-paste the range A1:E8 into your posting. See my example below.

We might __guess__ that the formulas in E2:E6 are of the form =B2, and the formula in E8 is =SUM(E2:E7). That would create the circular reference in B2.

BTW, the correct syntax for your formula in B2 is:

=IF(AND(C2>2, E8>0), -2, 0)

"&" is __not__ the "and" operator in Excel. And do not put double-quotes around numbers; "0" is text.

Be that as it may, although I am not enamored to your design overall, the following would correct both design problems.

Book1
ABCDE
1AmtCkg balLoan
2init bal714
3pmt 1-25-2
4pmt 2-23-2
5pmt 3-21-2
6pmt 4010
7pmt 5010
8
98
Sheet1
Formulas:
B3: =IF(AND(C2>2, SUM($E$2:E2)>0), -2, 0)
C3: =C2+B3
E3: =B3
E9: =SUM(E2:E8)
Copy B3:E3 into B4:E7

(With XL2BB, we can see the formulas by selecting each cell.)

The key is to calculate the balance of the loan separately in column B, instead of relying on the balance that is calculated in E9.
 
Upvote 0
Contrary to the adage, "a picture is __not__ worth 1000 words", usually. At the very least, you should __tell__ us what all the formulas are. Even better, use the XL2BB add-in to copy-and-paste the range A1:E8 into your posting. See my example below.

We might __guess__ that the formulas in E2:E6 are of the form =B2, and the formula in E8 is =SUM(E2:E7). That would create the circular reference in B2.

BTW, the correct syntax for your formula in B2 is:

=IF(AND(C2>2, E8>0), -2, 0)

"&" is __not__ the "and" operator in Excel. And do not put double-quotes around numbers; "0" is text.

Be that as it may, although I am not enamored to your design overall, the following would correct both design problems.

Book1
ABCDE
1AmtCkg balLoan
2init bal714
3pmt 1-25-2
4pmt 2-23-2
5pmt 3-21-2
6pmt 4010
7pmt 5010
8
98
Sheet1
Formulas:
B3: =IF(AND(C2>2, SUM($E$2:E2)>0), -2, 0)
C3: =C2+B3
E3: =B3
E9: =SUM(E2:E8)
Copy B3:E3 into B4:E7

(With XL2BB, we can see the formulas by selecting each cell.)

The key is to calculate the balance of the loan separately in column B, instead of relying on the balance that is calculated in E9.
Thank you so much, is there to add where it will figure out to pay the remaining balance if I replenish the funds later on. I am struggle with the remaining funds. Thanks.
 
Upvote 0
is there to add where it will figure out to pay the remaining balance if I replenish the funds later on. I am struggle with the remaining funds.

I'm afraid I do not understand the question well enough to craft a solution.

In general, I would keep cumulative balances (checking account; loan) separate from changes (payments; deposits). And you might need separate columns of changes: one for the checking account; another for the loan. Use positive and negative values to distinguish deposits and payments (withdrawals).

You did that with the checking account (columns B and C). But for the loan, you mix balances (E2 and E9) and changes (E3:E7) in the same column.
 
Upvote 0
I'm afraid I do not understand the question well enough to craft a solution.

In general, I would keep cumulative balances (checking account; loan) separate from changes (payments; deposits). And you might need separate columns of changes: one for the checking account; another for the loan. Use positive and negative values to distinguish deposits and payments (withdrawals).

You did that with the checking account (columns B and C). But for the loan, you mix balances (E2 and E9) and changes (E3:E7) in the same column.
1605649283604.png



I am sorry I modified the formula a little bit to ensure if checking account allows I can paydown fast. My question will be, I want the formula to pick up that remaining $1 if possible , I know this will probably run into circular reference again. Thanks.
 
Upvote 0
I am sorry I modified the formula a little bit to ensure if checking account allows I can paydown fast. My question will be, I want the formula to pick up that remaining $1 if possible

I won't be able to help you further. I do not understand the change that you made, and your intentions are not clear to me.

I hope someone else will step in to work with you. Good luck!
 
Upvote 0
I won't be able to help you further. I do not understand the change that you made, and your intentions are not clear to me.

I hope someone else will step in to work with you. Good luck!
Sorry, you have helped me a great deal. I changed the formula so I could pay the largest amount possible if my checking balance is greater than 2. My only problem is for this formula somehow to validate the last piece so it doesn’t go thru $14 loan balance. As you can see if I continue to pull down the formula, it will overpay.
 
Upvote 0
It would help to show how your checking account increases in value after you take money out.
 
Upvote 0

Forum statistics

Threads
1,216,109
Messages
6,128,883
Members
449,477
Latest member
panjongshing

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