+ Reply to Thread
Results 1 to 14 of 14

Problem with adding up formula

Hybrid View

  1. #1
    Registered User
    Join Date
    12-23-2006
    Posts
    12

    Problem with adding up formula

    Hi all

    I hope someone can help me with this formula as its doing my head in

    I am trying to make up a sheet that auto calcs miles per gallon etc.

    The problem I have is that if i put in the miles everytime then there is no problem getting everything to work

    but if I put in only litres and no miles I can't get it to add up the litres on each row "until" the miles are put in, but ONLY back up to where the miles were last added

    I can understand why the formulas I have been trying are NOT working, I just can't sus the formula that will work

    I have shown in the attachment what I need it to do by putting in the answers manually and I have also shown one of the formulas I have tried which does not work

    hope someone can help me with this

    thanks in anticipation

    Gordon
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    08-14-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    573

    Re: Problem with adding up formula

    Try this formula
    Formula: copy to clipboard
    =SUM(IF(C5="",0,INDIRECT("B"&LARGE(IF($C$1:C4<>"",ROW($C$1:C4)),1)+1&":B"&ROW())))
    entered with ctrl+shift+enter

  3. #3
    Forum Contributor Dave H9's Avatar
    Join Date
    03-10-2011
    Location
    Manchester, England
    MS-Off Ver
    Excel 2007
    Posts
    418

    Re: Problem with adding up formula

    I think I may be misunderstanding but here goes -

    Column B is litres
    Column C is miles

    Should column D not be working out miles per litre (BxC)?
    Or should you be converting to MPG (BxCx3.78541178)?

    For total just sum all column C at the end of your data.

    Dave H
    - Mark your post [SOLVED] if it has been answered satisfactorily, by editing your original post using advanced mode.
    - Thank those that provided useful help, its nice and its very well appreciated...use the star on the lower left of the post

  4. #4
    Registered User
    Join Date
    12-23-2006
    Posts
    12

    Re: Problem with adding up formula

    thanks for the quick replies

    Try this formula

    Formula:
    =SUM(IF(C5="",0,INDIRECT("B"&LARGE(IF($C$1:C4<>"",ROW($C$1:C4)),1)+1&":B"&ROW()))) entered with ctrl+shift+enter
    Sorry but you have completly lost me here


    Should column D not be working out miles per litre (BxC)?
    No as that is worked out in another colum but in order for that calc to work I need the answer from colum D ie the total amount of litres that has been added

    colum D has to work out how many litres has been put in since the miles was recorded last as per the the attachment


    if the litre's and miles are recorded in every row then the calcs would work fine with no problems

    But like in the attachment the miles will not be added in every row and thats where the probs start

    When the miles are not added in each row I need the litres in all the previous rows (up to the row where the mile were last added) to add up, and thats what I can't make happen automatically

    hope that makes sense

    I will make up a dummy sheet with actual entries and attach it to see if that clears up the confusion as to what I need

    Thanks

    Gordon

  5. #5
    Valued Forum Contributor
    Join Date
    08-14-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    573

    Re: Problem with adding up formula

    Is this not your requirement?
    [QUOTE
    Sorry but you have completly lost me here



    [/QUOTE]

  6. #6
    Forum Contributor Dave H9's Avatar
    Join Date
    03-10-2011
    Location
    Manchester, England
    MS-Off Ver
    Excel 2007
    Posts
    418

    Re: Problem with adding up formula

    I would say that Sinhus has given you the solution.

    Please see attached.

    Dave H
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    12-23-2006
    Posts
    12

    Re: Problem with adding up formula

    Sorry Sinhus,

    yes you have gave me the solution,
    I just didn't put it correct the first time so didn't get it to work
    as I never changed the first cell number (what a donut I am) its been one of them days up to now but hopefully it will now get better lol

    Thank you thank you thank you very much

    And thanks to you as well Dave H for spelling it out for me in the sheet

    much appreciation to both of you

    thank you

    Gordon

  8. #8
    Registered User
    Join Date
    12-23-2006
    Posts
    12

    Re: Problem with adding up formula

    Sorry Folks

    The formula works on the test spready but when I try to add colums in the front of the formula colum it goes back to zero or when I enter the formula into the sheet I am working on it just comes up saying

    #VALUE!

    What am I doing wrong????????

    any ideas please

    Have attached the sheet I am working on see if that helps

    Thanks

    Gordon
    Attached Files Attached Files
    Last edited by gorang; 11-06-2012 at 10:05 AM.

  9. #9
    Registered User
    Join Date
    12-23-2006
    Posts
    12

    Re: Problem with adding up formula

    Thanks Dave H9

    That worked a dream

    Thank you very very much

    star has been clicked

  10. #10
    Registered User
    Join Date
    12-23-2006
    Posts
    12

    Re: Problem with adding up formula

    Thank you Fotis1991

    Just got it when you were repling to me

    Thanks again for everyones help with this

    Gordon

  11. #11
    Forum Contributor Dave H9's Avatar
    Join Date
    03-10-2011
    Location
    Manchester, England
    MS-Off Ver
    Excel 2007
    Posts
    418

    Re: Problem with adding up formula

    Hi Gordon,

    It is an array formula which was provided. Try selecting cell H9, instead of pressing just enter, hold CTRL+Shift and press enter. You will notice the formula is now surrounded by this type of bracket -{} signifying an array formula. You can now copy this cell down the required range.


    Dave H

  12. #12
    Registered User
    Join Date
    12-23-2006
    Posts
    12

    Re: Problem with adding up formula

    Sorry I forgot to add I am using office 2010 if that makes a difference

  13. #13
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Problem with adding up formula

    You have to confirm the formula using Control+shift+Enter-Not just enter. This is an Array formula.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  14. #14
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Problem with adding up formula

    You are welcome Gordon. In fact i did nothing. Congr to Sindhus for the nice formula and of course to Dave for all help that provided.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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