• Running Total Formula (XP)

    Author
    Topic
    #403772

    Beginning balance in D4 – subsequent transactions in C5:C2000 – formula in D5:D2000 subtracting current transaction from previous balance. What I need is a formula in a non-print area cell that always shows the current balance – this is the one I currently use: =INDIRECT(“D”&MAX(IF(ISBLANK(D6:D22),0,ROW(D6:D22))))

    Is there an easier way?

    Thanks

    Linda

    Viewing 1 reply thread
    Author
    Replies
    • #815982

      Linda
      It’s nice to have a balance that never goes into overdraft grin

      One way is to make your “balance cell” calculate from transactions. = Opening Balance – SUM(TransactionColumn)
      e.g. assuming your transaction values are column C, and your opening balance was in Cell D1the formula =D1-SUM(C:C) does the trick

      Personally, if I have this kind of open ‘list’ I also tend to have a pivot table summarising it by periods – the totals are easy to come by from the pivot table grin

      • #815998

        I obviously didn’t explain myself very well – I show my beinning balance in cell G4. In a cell I don’t wish to print I want to always see the CURRENT balance .

        In Cells G6 through infinity I will have a formula that displays the current balance – today that balance might be in G200 – tomorrow it might be in G2000.

        Hopefully I’ve been more clear – it hasn’t been a very clear day for me.

        Thanks in advance

        aunt linda

        • #816014

          As Andrew stated shouldn’t the current balance be the starting balance minus the sum of all the transactions?

          =G6-Sum(C:C)

          As you add more transactions to col C you will add or subract more from G6 to give the current balance.

          Steve

          • #816026

            It, of course, works perfectly. And you might be able to help me if I told you the WHOLE story about this particular worksheet – boy, what a day I’m having!

            The first 5 rows are filled with account identification stuff – for example, PO#, Invoice Maximum, Account #, Company Name, etc.

            The other part of the story I omitted is that the final current balance is the result of a formula that subtracts the amount spent from the current balance, then adds any encumbrances, then subtracts any disencumbrances, and then adds any credits – I’m sure that’s what’s making this so difficult – for me anyway.

          • #816027

            It, of course, works perfectly. And you might be able to help me if I told you the WHOLE story about this particular worksheet – boy, what a day I’m having!

            The first 5 rows are filled with account identification stuff – for example, PO#, Invoice Maximum, Account #, Company Name, etc.

            The other part of the story I omitted is that the final current balance is the result of a formula that subtracts the amount spent from the current balance, then adds any encumbrances, then subtracts any disencumbrances, and then adds any credits – I’m sure that’s what’s making this so difficult – for me anyway.

        • #816015

          As Andrew stated shouldn’t the current balance be the starting balance minus the sum of all the transactions?

          =G6-Sum(C:C)

          As you add more transactions to col C you will add or subract more from G6 to give the current balance.

          Steve

        • #816028

          Linda
          Editted to remove comments put in in parallel with Linda’s previous post

          An alternative method could involve the use of dates.

          For instance, if each transaction has a date (assuming column(A) has ascending dates) then you could do a VLOOKUP for latest date and find the balance column.
          =VLOOKUP(TODAY(),A:G,7,TRUE)

          • #816030

            It, of course, works perfectly. And you might be able to help me if I told you the WHOLE story about this particular worksheet – boy, what a day I’m having!

            The first 5 rows are filled with account identification stuff – for example, PO#, Invoice Maximum, Account #, Company Name, etc.

            The other part of the story I omitted is that the final current balance is the result of a formula that subtracts the amount spent from the current balance, then adds any encumbrances, then subtracts any disencumbrances, and then adds any credits – I’m sure that’s what’s making this so difficult – for me anyway.

            • #816070

              Linda
              I’m confused – your second reply is an awful lot like your first reply so I’m not sure if you’re rejecting the date method or not..

              I’ll try an alternate method

              =OFFSET(G4,COUNT(G5:G2000),0)

              You may have to add or sutract a constant to the count to get precisely the right row.

            • #816813

              Here ya go – sorry I’m being such a pain – it’s just really, really irritating that I can’t make this work!

            • #816843

              I am still not clear since you only have 1 formula and the setup does not look like your previous notes. Are you looking for the “total current balance”:

              =F2+SUM(C:C,E:E)-SUM(B:B,D:D)

              If not could you provide a little explanation of what you want (referencing the example file).

              Steve

            • #816844

              I am still not clear since you only have 1 formula and the setup does not look like your previous notes. Are you looking for the “total current balance”:

              =F2+SUM(C:C,E:E)-SUM(B:B,D:D)

              If not could you provide a little explanation of what you want (referencing the example file).

              Steve

            • #816909

              Everything I see in your example suggests that the offset method will work – as in the attachment grin

            • #816927

              Perfect – THANK YOU!

              Now please explain the formula to me so I can share with others.

              Aunt Linda

            • #816948
              =OFFSET(H2,COUNT(F:F),-2)

              Gets the value that is 2 columns to the left (=-2), and the number of rows that equals the count of numbers in Col F down [Count(F:F)] from cell H2

              Steve

            • #817477

              That’s exactly the wording I needed to grasp this – thank you soooooooo much.

              Linda

            • #817478

              That’s exactly the wording I needed to grasp this – thank you soooooooo much.

              Linda

            • #816949
              =OFFSET(H2,COUNT(F:F),-2)

              Gets the value that is 2 columns to the left (=-2), and the number of rows that equals the count of numbers in Col F down [Count(F:F)] from cell H2

              Steve

            • #816956

              It is important to the results in Andrew’s formula that there are no rows with contiaining non-numerics (text, errors, blanks) within the datarange. Thus different setups could result in incorrect results.

              The formula I gave in post 364795 will not have this problem.

              Another way to do it is to use the formula:

              =VLOOKUP(9.99999999999999E+307,F:F,1)

              Which will give the number that is furthest down in column F, even if there are blanks or text in the column. This Vlookup looksup the “large number” (max for excel) as it looks it will not find it so it keeps going further down the row, until it gets the last number, which it reports.

              Steve

            • #816957

              It is important to the results in Andrew’s formula that there are no rows with contiaining non-numerics (text, errors, blanks) within the datarange. Thus different setups could result in incorrect results.

              The formula I gave in post 364795 will not have this problem.

              Another way to do it is to use the formula:

              =VLOOKUP(9.99999999999999E+307,F:F,1)

              Which will give the number that is furthest down in column F, even if there are blanks or text in the column. This Vlookup looksup the “large number” (max for excel) as it looks it will not find it so it keeps going further down the row, until it gets the last number, which it reports.

              Steve

            • #817003

              Linda

              Note everything that Steve says – the cautions are important. The SUM method he suggests works too for the example you gave and is likely to be resillient unless you do anything really tricky with adds and subtracts directly into the balances.

              =OFFSET(H2,COUNT(F:F),-2)
              Relies on the fact that COUNT returns a result that is a count of “filled in” cells – all sorts of things are counted as filled in. My assumption therefore is that your column is “clean” – if it’s not avoid this method.

              OFFSET is a nifty function that makes a relative reference from a defined cell e.g. OFFSET(A1,+5,+3) references the cell 5 rows down and 3 across – i.e. D6.
              OFFSET(A1,0,0) references itself and negative numbers can be used too e.g. OFFSET(B2,-1,-1) is A1.

              To work out what formulae do – simply look at them one by one and dive into help if necessary..
              e.g. enter =COUNT(F:F) into a cell and see its result.
              Then, in a separate cell, see what the OFFSET does if the explanation above isn’t clear enough.

              On a totally different topic – OFFSET is really useful for making total lines really include all data! If you have a column of data A1:A99 and want to sum it, many people put =SUM(A1:A99) in cell A100.
              This is great until they add a new data entry line in A100 and displace the total down to A101. Examination will show that the TOTAL has missed out adding the new data at A100. If the original sum had been coded as =SUM(A1:OFFSET(A100,-1,0)) there would be no such problem. grin

            • #817582

              Andrew,

              I always told people NOT to insert above the “totals” row for the reason you mention. Solutions like the row above the totals saying “insert new rows above here” are what people have used, which is definitely kludgy. So your OFFSET approach is nice. Because when you insert a row directly above the totals row, the base of the offset is adjusted.

              Except…
              To my surprise, I decided to insert a row above the totals row (values a2:a13, totals in a14). Total in a14 moves to a15 and a14 is blank. Formula in a14 still reads SUM(a2:a13). I put a value into a14 and hit enter. As soon as I hit enter, what I see is a highlight of a15 and then the cell selection jumps back to a14. I examine a15 and it is now SUM(a2:a14).

              I look at the edit options and there’s an option that seems to address this: Extend list formats and formulas, which is checked. When I uncheck this, the above behavior does NOT happen. Of course, I couldn’t find this in the help to see what else is said about the option. So it looks like this allows you to “have your cake and eat it too”.

              Of course, the above is in XP (which Linda was using). Not sure if it was there earlier…who will tell us?

              And we’re continuing your detour on Linda’s thread on running totals.

              Fred

            • #817584

              Andrew,

              I always told people NOT to insert above the “totals” row for the reason you mention. Solutions like the row above the totals saying “insert new rows above here” are what people have used, which is definitely kludgy. So your OFFSET approach is nice. Because when you insert a row directly above the totals row, the base of the offset is adjusted.

              Except…
              To my surprise, I decided to insert a row above the totals row (values a2:a13, totals in a14). Total in a14 moves to a15 and a14 is blank. Formula in a14 still reads SUM(a2:a13). I put a value into a14 and hit enter. As soon as I hit enter, what I see is a highlight of a15 and then the cell selection jumps back to a14. I examine a15 and it is now SUM(a2:a14).

              I look at the edit options and there’s an option that seems to address this: Extend list formats and formulas, which is checked. When I uncheck this, the above behavior does NOT happen. Of course, I couldn’t find this in the help to see what else is said about the option. So it looks like this allows you to “have your cake and eat it too”.

              Of course, the above is in XP (which Linda was using). Not sure if it was there earlier…who will tell us?

              And we’re continuing your detour on Linda’s thread on running totals.

              Fred

            • #817589

              Andrew,

              When I responded to you a few moments ago, actually that wasn’t the real reason I was initially going to respond. You mentioned about looking at formulas and going to help to figure out what’s going on.

              ANother new feature of XP is the Formula Evaluator on the Formula AUditing toolbar. With a cell selected, the toolbar shows the formula. There’s an Evaluate button. Each click on it evaluates one part of the formula just as Excel would. Keep clicking until you get the value for the cell in the toolbar display, at which point the Evaluate button turns into a Restart (to restart the formula from the beginning). Sure beats using the F9 key and highlighting parts of the formula in the formula bar.

              And so we stray even further from Linda’s original question.

              Fred

            • #817592

              Andrew,

              When I responded to you a few moments ago, actually that wasn’t the real reason I was initially going to respond. You mentioned about looking at formulas and going to help to figure out what’s going on.

              ANother new feature of XP is the Formula Evaluator on the Formula AUditing toolbar. With a cell selected, the toolbar shows the formula. There’s an Evaluate button. Each click on it evaluates one part of the formula just as Excel would. Keep clicking until you get the value for the cell in the toolbar display, at which point the Evaluate button turns into a Restart (to restart the formula from the beginning). Sure beats using the F9 key and highlighting parts of the formula in the formula bar.

              And so we stray even further from Linda’s original question.

              Fred

            • #817004

              Linda

              Note everything that Steve says – the cautions are important. The SUM method he suggests works too for the example you gave and is likely to be resillient unless you do anything really tricky with adds and subtracts directly into the balances.

              =OFFSET(H2,COUNT(F:F),-2)
              Relies on the fact that COUNT returns a result that is a count of “filled in” cells – all sorts of things are counted as filled in. My assumption therefore is that your column is “clean” – if it’s not avoid this method.

              OFFSET is a nifty function that makes a relative reference from a defined cell e.g. OFFSET(A1,+5,+3) references the cell 5 rows down and 3 across – i.e. D6.
              OFFSET(A1,0,0) references itself and negative numbers can be used too e.g. OFFSET(B2,-1,-1) is A1.

              To work out what formulae do – simply look at them one by one and dive into help if necessary..
              e.g. enter =COUNT(F:F) into a cell and see its result.
              Then, in a separate cell, see what the OFFSET does if the explanation above isn’t clear enough.

              On a totally different topic – OFFSET is really useful for making total lines really include all data! If you have a column of data A1:A99 and want to sum it, many people put =SUM(A1:A99) in cell A100.
              This is great until they add a new data entry line in A100 and displace the total down to A101. Examination will show that the TOTAL has missed out adding the new data at A100. If the original sum had been coded as =SUM(A1:OFFSET(A100,-1,0)) there would be no such problem. grin

            • #816928

              Perfect – THANK YOU!

              Now please explain the formula to me so I can share with others.

              Aunt Linda

            • #816910

              Everything I see in your example suggests that the offset method will work – as in the attachment grin

            • #816814

              Here ya go – sorry I’m being such a pain – it’s just really, really irritating that I can’t make this work!

            • #816071

              Linda
              I’m confused – your second reply is an awful lot like your first reply so I’m not sure if you’re rejecting the date method or not..

              I’ll try an alternate method

              =OFFSET(G4,COUNT(G5:G2000),0)

              You may have to add or sutract a constant to the count to get precisely the right row.

            • #816152

              I am also confused. If Andrew’s latest post does not answer your question, could you post a little example file detailing what you want/need?

              Steve

          • #816031

            It, of course, works perfectly. And you might be able to help me if I told you the WHOLE story about this particular worksheet – boy, what a day I’m having!

            The first 5 rows are filled with account identification stuff – for example, PO#, Invoice Maximum, Account #, Company Name, etc.

            The other part of the story I omitted is that the final current balance is the result of a formula that subtracts the amount spent from the current balance, then adds any encumbrances, then subtracts any disencumbrances, and then adds any credits – I’m sure that’s what’s making this so difficult – for me anyway.

        • #816029

          Linda
          Editted to remove comments put in in parallel with Linda’s previous post

          An alternative method could involve the use of dates.

          For instance, if each transaction has a date (assuming column(A) has ascending dates) then you could do a VLOOKUP for latest date and find the balance column.
          =VLOOKUP(TODAY(),A:G,7,TRUE)

      • #815999

        I obviously didn’t explain myself very well – I show my beinning balance in cell G4. In a cell I don’t wish to print I want to always see the CURRENT balance .

        In Cells G6 through infinity I will have a formula that displays the current balance – today that balance might be in G200 – tomorrow it might be in G2000.

        Hopefully I’ve been more clear – it hasn’t been a very clear day for me.

        Thanks in advance

        aunt linda

    • #815983

      Linda
      It’s nice to have a balance that never goes into overdraft grin

      One way is to make your “balance cell” calculate from transactions. = Opening Balance – SUM(TransactionColumn)
      e.g. assuming your transaction values are column C, and your opening balance was in Cell D1the formula =D1-SUM(C:C) does the trick

      Personally, if I have this kind of open ‘list’ I also tend to have a pivot table summarising it by periods – the totals are easy to come by from the pivot table grin

    Viewing 1 reply thread
    Reply To: Running Total Formula (XP)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: