Topic: Circular references  (Read 1684 times)

0 Members and 1 Guest are viewing this topic.

Offline Clark Kent

  • Captain
  • *
  • Posts: 6071
  • Gender: Male
Circular references
« on: May 05, 2009, 11:48:03 am »
perhaps one of you fine mathematical and scientific gents can lend a hand:

I am being asked to determine a figure.  Imagine three colums on a table.  The first column is a subtotal.  The next column is an adjustment to the subtotal, which is a sum of a bunch of different adjustment amounts.  Finally is the total column.

Now, my problem, right now, I use the subtotal amount to determine an amount for the adjustment column, which then feeds into the total column.  What I am being required now to do (because my boss feels it is more accurate) is to use the total column to determine the adjustment amount, which in turn feeds into the total column.  I need the new amount in the adjustments column to be such that it comes to the right amount in the totals column.  This creates a circular reference.  I'm sure that I've seen a way to get around this little mathematical problem, but my mind is blanking on this issue.  Any ideas?
CK

But tell me, can you heal what father's done?
Or fix this hole in a mother's son?
Can you heal the broken worlds within?
Can you strip away so we may start again?
Tell me, can you heal what father's done?
Or cut this rope and let us run?
Just when all seems fine, and I'm pain free, you jab another pin,
Jab another pin in me
-Metallica

Offline marstone

  • Because I can
  • Commander
  • *
  • Posts: 3014
  • Gender: Male
  • G.E.C.K. - The best kit to have
    • Ramblings on the Q3, blog
Re: Circular references
« Reply #1 on: May 05, 2009, 12:27:31 pm »
sounds like a stupid way of doing it.  you take the total amount subtract the subtotal amount will give you the adjustment to subtotal.  But if the adjustment of subtotal is supose to be a collection of other adjustments, you would be nulling what they add up to, just to make the numbers work (or pad larger if you adjust your total higher).

how does the adjustment to the subtotal amount get figured out the old way?
The smell of printer ink in the morning,
Tis the smell of programming.

Offline Czar Mohab

  • Faith manages.
  • Lt.
  • *
  • Posts: 564
  • Gender: Male
  • Chewie - Go jiggle the handle!
Re: Circular references
« Reply #2 on: May 05, 2009, 12:28:31 pm »
Think I need more input, but sounds like your boss is trying to put the cart before the horse in this. Like he wants you to know the total before you find the adjustments, meaning your equation goes from SUB + ADJ = TOTAL to ADJ = TOTAL - SUB. But then I feel that there is more to this than just that, perhaps. Like your boss and you only know the SUB and want both the ADJ and TOTAL from that one number.

Since ADJ is a variable independant of SUB, I can see where the true issue is; being that ADJ will almost always be something different for any given SUB (and TOTAL).

You can try adding a "PREADJUSTMENT" column and "GRAND TOTAL" column that can be fed information to make it more linear:

SUB = Only given #
PADJ = Whatever equation you use to get the current Adjustment, output varies
TOT = SUB + PADJ
ADJ = Whatever tweak equation you need to refine the number, say add 2% or something, output varies
GTOT = ADJ + TOT

Or, Expanded:

(SUB+PADJ)+ADJ=GTOT =>
(SUB+(EQN))+(Another EQN)=GTOT

But I still think I need a bit more info. I understand that company confidentiality exists and I'm not asking you to break that in any way! Just need more input.

Czar "Johnny 5, ALIVE!" Mohab
US Navy Veteran - Proud to Serve
Submariners Do It Underwater - Nukes Do It Back Aft - Pride Runs Deep
Have you thanked a Vet lately?

Subaru Owners Do It Horizontally Opposed!
Proud Owner - '08 WRX - '03 Baja - '98 Legacy

Offline Clark Kent

  • Captain
  • *
  • Posts: 6071
  • Gender: Male
Re: Circular references
« Reply #3 on: May 05, 2009, 02:16:14 pm »
It is completely putting the cart before the horse.  What it boils down to is I'm trying to remove costs related to a tenant at one of our buildings, so the subtotal column is before I make that adjustment (and several others). The total column gives me the "true" cost of the cost center (after things like this cost center are removed.  This is done via proprietary software, so I can't fiddle with the calculation order.  The software will always calculate sub-adj=total. 

The reason she wants the total column used instead of the sub is because I'm trying to allocate a percent of costs for the cost center compared to the entire hospital.  If I use sub, then I'm allocating more than I would if I'm using the total for this adjustment. 

Net result: find total, so I can determine the adj column.  Once I have that figured out, I put it into the software, which then recalculates the total for me.
CK

But tell me, can you heal what father's done?
Or fix this hole in a mother's son?
Can you heal the broken worlds within?
Can you strip away so we may start again?
Tell me, can you heal what father's done?
Or cut this rope and let us run?
Just when all seems fine, and I'm pain free, you jab another pin,
Jab another pin in me
-Metallica

Offline Bonk

  • Commodore
  • *
  • Posts: 13298
  • You don't have to live like a refugee.
Re: Circular references
« Reply #4 on: May 05, 2009, 02:43:27 pm »
Sounds like a job for Excel's "solver" add-in. Or a macro with an algorithm of your own design. The conditional sum wizard might also be useful.

Offline marstone

  • Because I can
  • Commander
  • *
  • Posts: 3014
  • Gender: Male
  • G.E.C.K. - The best kit to have
    • Ramblings on the Q3, blog
Re: Circular references
« Reply #5 on: May 05, 2009, 02:45:38 pm »
to me it seems you will have to set up a second spreadsheet, that will figure total-sub=adjustment, so you can plug in the right adjustment into the program you are using to get the right answer.

If I understand correctly she wants the total to be a proper percent in the whole of things, so to make sure it fits you have to fudge the adjustment column to make it fit right.

But since you can't change how the software figures out the answer (always sub-adj=total), I think you will need another spreadsheet to work out the number to readjust the main program data.

since you know the cost involved with the cost center entailing the client, could you not put in adjustments for that to remove them?  That would skip the whole circular problem.  But adds more information to the system that might need to be noted.
The smell of printer ink in the morning,
Tis the smell of programming.

Offline toasty0

  • Application.Quit();
  • Captain
  • *
  • Posts: 8045
  • Gender: Male
Re: Circular references
« Reply #6 on: May 05, 2009, 07:27:46 pm »
perhaps one of you fine mathematical and scientific gents can lend a hand:

I am being asked to determine a figure.  Imagine three colums on a table.  The first column is a subtotal.  The next column is an adjustment to the subtotal,

How is this adjustment being determined?

Quote
which is a sum of a bunch of different adjustment amounts.  Finally is the total column.

Sum of what? The subtotal column or the adjustment column, or some other rows and columns?

Quote
Now, my problem, right now, I use the subtotal amount to determine an amount for the adjustment column,

Assuming you're using a spreadsheet(Excel?), can you share your formula with us?

Quote
which then feeds into the total column.  What I am being required now to do (because my boss feels it is more accurate) is to use the total column to determine the adjustment amount, which in turn feeds into the total column. 

It shouldn't. Your adjustment is a function of something else acting upon your subtotals. In other words, you have a subtotal that is being adjusted by some other values/functions/formula (not the values in the total column) which in turn is summarized to give you your totals.

Quote
I need the new amount in the adjustments column to be such that it comes to the right amount in the totals column.  This creates a circular reference.  I'm sure that I've seen a way to get around this little mathematical problem, but my mind is blanking on this issue.  Any ideas?

a=a+n where n is the sum of some other iterative function. But that does not apply here. What you have here is either bad accounting/bookkeeping practices...

Wish you well and good luck.
MCTS: SQL Server 2005 | MCP: Windows Server 2003 | MCTS: Microsoft Certified Technology Specialist | MCT: Microsoft Certified Trainer | MOS: Microsoft Office Specialist 2003 | VSP: VMware Sales Professional | MCTS: Vista

Offline Clark Kent

  • Captain
  • *
  • Posts: 6071
  • Gender: Male
Re: Circular references
« Reply #7 on: May 05, 2009, 09:34:42 pm »
Technically, it's not bookkeeping, it's "cost allocation."  I don't really like it, but then, since when does my opinion matter?

OK, I'll try and explain again: I need an adjustment for the adjustment column.  Right now, I take the amount in the sub column and multiply it by a percent to total (square feet for this department to the total square feet for the building).  What I am told now is that I need to use the total column instead of the subtotal column to get my adjustment amount- I need to take my percent to total and multiply it by the total column. 

The problem is that I am trying to figure out the adjustment column, which then automatically is used to calculate the total column.  To figure out the adjustment column, I am now supposed to use the total column, which is then used to figure out the total column.

I can use excel to figure it out, but I still have to enter it into the software I'm using which calculates the total column itself.  I enter in the adjustments myself.
CK

But tell me, can you heal what father's done?
Or fix this hole in a mother's son?
Can you heal the broken worlds within?
Can you strip away so we may start again?
Tell me, can you heal what father's done?
Or cut this rope and let us run?
Just when all seems fine, and I'm pain free, you jab another pin,
Jab another pin in me
-Metallica