+ Reply to Thread
Results 1 to 15 of 15

Formulas causing circular reference

  1. #1
    Registered User
    Join Date
    02-24-2013
    Location
    NY
    MS-Off Ver
    Excel 2007
    Posts
    18

    Formulas causing circular reference

    Hello,

    I am trying to make this worksheet to help me with scheduling at work. I have it set up that if you put in a percentage in column B it will calculate the hours in column C and have a running total of the hours and percentage in D&E2. Is there any way to set it up that I can put in hours in column C to get the percentages in column B in addition to the way it is set up now without creating a circular reference? I would like to put the percentages in column B to get the hours in column C and then adjust the hours in column C which in turn would change the percentages. I have tried so many formulas in both columns but keep getting a circular reference error.

    Thank you,

    John

    Attachment 313465
    Attached Files Attached Files
    Last edited by jm263; 04-24-2014 at 09:39 PM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Formulas causing circular reference

    Quote Originally Posted by jm263 View Post
    I would like to put the percentages in column B to get the hours in column C and then adjust the hours in column C which in turn would change the percentages.
    What you said you want here is the very definition of a circular reference. You can't do that without a circular reference, and to complicate matters you can't have a formula and a constant in a cell at the same time. That is, if you overtype a formula in column C to force a change in hours, that formula is gone forever.

    The only way to do this without creating a circular reference is to use VBA code to detect a change in either B or C (Worksheet_Change) and then recalculate the corresponding value in the other column.

    See attached.
    Attached Files Attached Files
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    02-24-2013
    Location
    NY
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Formulas causing circular reference

    Hi Jeff,

    Thank you for the response and help. When I try to enter figures, a prompt pops up stating
    Run-time error '28': Out of stack space with the options to end or debug. Am I doing something wrong or
    do I have to remove the existing formulas in the sheet?

    Thanks again,

    John

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Formulas causing circular reference

    I don't get that problem but I think I know what's wrong. Try adding these lines to the code.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-24-2013
    Location
    NY
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Formulas causing circular reference

    Hello,
    That worked perfectly. You have saved me hundreds of work hours over the course of a year at my job. If you could help with one more thing with this worksheet, it will be complete. When I was just using formulas, I could change the number in the BUDGETED HOURS or FRONT END boxes and it would change the ALLOTTED HOURS TO SCHEDULE column as long as I had the PERCENTAGE of AVAILABLE HOURS filled in. Is there a way that if I could change the BUDGETED HOURS and/or FRONT END numbers and the two columns would change automatically?

    Thank you so much,
    John
    Last edited by jm263; 04-23-2014 at 09:39 AM.

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Formulas causing circular reference

    It is possible but I need you to think a little about how you want this to work. Let's say I have 100 budgeted hours. On one line I have 10% and 10 hours. Now suppose you change Budgeted Hours to 200. Do you want to change the percentage to 5% and leave the 10 hours alone, or leave 10% alone and change the hours to 20? Or does it depend on which number I entered manually?

  7. #7
    Registered User
    Join Date
    02-24-2013
    Location
    NY
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Formulas causing circular reference

    Hi Jeff,
    Ideally I would like both the percentage and hours in the columns to change automatically when I alter the budgeted hours or front end hours

    Thanks,

    John
    Last edited by jm263; 04-23-2014 at 03:00 PM.

  8. #8
    Registered User
    Join Date
    02-24-2013
    Location
    NY
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Formulas causing circular reference

    Hi,

    I'll repost that. It didn't make sense.

    John

  9. #9
    Registered User
    Join Date
    02-24-2013
    Location
    NY
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Formulas causing circular reference

    Hi,

    I would like the hours to change based off of the percentages when I alter the budgeted or front end numbers.

    John

  10. #10
    Registered User
    Join Date
    02-24-2013
    Location
    NY
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Formulas causing circular reference

    Hi,
    Would the AVAILABLE HOURS TO SCHEDULE cell be the target cell since changing the BUDGETED HOURS or FRONT END hours is giving the number to be multiplied by the PERCENT OF AVAILABLE HOURS cells?

  11. #11
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Formulas causing circular reference

    What do you mean by "target cell"? You mean Target in the VBA code? No. It has to be the cell that is actually changed the by the user. Cells with formulas that result in a different value do not trigger a Worksheet_Change event.

  12. #12
    Registered User
    Join Date
    02-24-2013
    Location
    NY
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Formulas causing circular reference

    Hi,

    I was just trying to figure out how to write the code. I'm not having any luck.

  13. #13
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Formulas causing circular reference

    Here is a solution that takes a slightly different approach. The sheet starts out with the percentages as values and the hours as formulas. If you enter a percentage, the hours will be calculated automatically by the formula. If you type in the hours, then the percentage is calculated and updated, and the value that you typed in for hours is then replaced by the formula, giving the same result as what you typed in.

    This has the advantage of having all the hours update from the formulas if A2 or B2 is changed.
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    02-24-2013
    Location
    NY
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Formulas causing circular reference

    Jeff,

    This is perfect! I can not thank you enough.

    John

  15. #15
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Formulas causing circular reference

    You're welcome! Thanks for the rep, and thanks for marking your thread Solved!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Array Formulas = Circular Reference Error?
    By tekman in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-31-2011, 07:08 PM
  2. Optimization causing circular reference warning
    By adb_bliu in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-14-2011, 12:51 PM
  3. Circular reference causing formula issue
    By spacemonkey82 in forum Excel General
    Replies: 3
    Last Post: 09-04-2011, 04:49 AM
  4. Circular Reference when formulas reference end of row formula!
    By Spellbound in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-29-2009, 08:26 AM
  5. Circular reference formulas
    By bazza jay in forum Excel General
    Replies: 5
    Last Post: 08-12-2008, 08:58 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1