+ Reply to Thread
Results 1 to 9 of 9

Lookup first Non zero cell and sum of all cells in the adjacent cell

Hybrid View

  1. #1
    Registered User
    Join Date
    11-25-2012
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003
    Posts
    3

    Lookup first Non zero cell and sum of all cells in the adjacent cell

    Hi Guys,

    I have been trying to put this formula together but have been successful so far. I have used "match, Index and row function but can't get the sum right.

    I have 4 columns A, B, C and D which is Day, Date, Amount and Refils respectfully.

    So I want to lookup first non zero number in Column D "which is Refil" and return the sum of all the column in the adjacent column which is "Amount" till that row.

    Example is: We want to lookup first non zero number and for instance it is on cell D29 then I require the sum of C2:C29. The formula should identify itself the first non zero number in column D everytime the sheet is updated and should return the sum of the cells in column C respectfully.

    Your help will be much appreciated.

    Cheers

    Azi
    Excel Threads.xls

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Lookup first Non zero cell and sum of all cells in the adjacent cell

    try

    =SUM(INDIRECT("$C$2:$C"&MATCH(SUMIF($D$2:$D$36,">"&0.01,$D$2:$D$36),$D$2:$D$36,0)))

  3. #3
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Lookup first Non zero cell and sum of all cells in the adjacent cell

    Is ROWS() available in 2003?

    if so you could use something like:
    Formula: copy to clipboard

    =IF(D2>0,SUM(OFFSET($C$2,ROW()-1,0,ROWS($C$2:$C$'last row of C")-(ROW()-2))),"")


    you would need to blank out any following rows, and this assumes the data starts in row 2...but should get you started at least

    Hope this Helps
    A picture may be worth a thousand words, BUT, a sample Workbook is worth a thousand screenshots!
    -Add a File - click advanced (next to quick post), scroll to manage attachments, click, select add files, click select files, select file, click upload, when file shows up at bottom left, click done (bottom right), click submit
    -To mark thread Solved- go top of thread,click Thread Tools,click Mark as Solved
    If you received helpful response, please remember to hit the * of that post

  4. #4
    Registered User
    Join Date
    11-25-2012
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Lookup first Non zero cell and sum of all cells in the adjacent cell

    Thankyou so much for that.
    I forgot to mention one thing that this sheet is part of a cost model and it is also linked with SQL which is updating information everytime we enter different sites. The formula turns into #N/A or 0 when I change the site and data updates. Also there can be multiple amounts in Column D but I want the first Non Zero to appear.

    Cheers

  5. #5
    Registered User
    Join Date
    11-25-2012
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Lookup first Non zero cell and sum of all cells in the adjacent cell

    @dredwolf
    Thankyou so much as well for your response,

    The formula appears with Blank cell as well and no results.

    Am I making any mistake? The sheet that I attached in my first post is exactly the same but obviously it is connected with SQL and hence we change the site name and the data changes but it should not matter I believe as only cells should change.

    Any thoughts?

    Cheers mate

  6. #6
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Lookup first Non zero cell and sum of all cells in the adjacent cell

    OK, I've uploaded a sample of what I am doing..see if that works for you..got rid of the following sums as well..

    Edit
    Revised formula:
    Formula: copy to clipboard

    =IF(COUNT($E$1:E1)=0,IF(D2*1>0,SUM(OFFSET($C$1,ROW()-1,0,ROWS(data)-(ROW()-2))),""),"")


    Hope this helps

    Edit2

    aah...sorry, missed the upload, getting blinder and can barely distinguish the color change, will try my formula on that
    Attached Files Attached Files
    Last edited by dredwolf; 11-26-2012 at 01:39 AM.

  7. #7
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Lookup first Non zero cell and sum of all cells in the adjacent cell

    well, I'm not reaaly sure, it works fine here, maybe you could upload a sample ?
    and I'm not sure if 2003 supports the ROWS() function, so that could be a problem ( although I'd expect to see a #NAME error in that case)...

  8. #8
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Lookup first Non zero cell and sum of all cells in the adjacent cell

    okay, looks like 2003 does not support ROWS(), so try this instead, it will give you 10000 rows of data to work with (up it if you need too )

    Formula: copy to clipboard

    =IF(COUNT($E$1:E1)=0,IF(D2*1>0,SUM(OFFSET($C$1,ROW()-1,0,10000-(ROW()-2))),""),"")

  9. #9
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Lookup first Non zero cell and sum of all cells in the adjacent cell

    See attachment, it is working for me here(compatibility mode), so see if it does for you

    Hope this works...lol
    Attached Files Attached Files

+ 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