+ Reply to Thread
Results 1 to 15 of 15

Ignore blanks in calculation

  1. #1
    Registered User
    Join Date
    11-13-2019
    Location
    Tallinn, Estonia
    MS-Off Ver
    2016
    Posts
    6

    Ignore blanks in calculation

    Hello!

    I just joined this forum and I hope I get many new tips and tricks to use Excel, but for now I have a problem.

    I have massive data with precipitation (daily), which I need to calculate into decades of precipitation, however my different forms of formulas won't seem to ignore blanks so far, but instead I get zeros as result (which is not correct). The thing is that I get blanks, if I put condition, when value is greater than zero and I get zeros instead of blank, when I use formula, where result may be equal or greater than zero. What I want is that I could include actual zeros in calculation, but exclude blanks from calculation, so that my results actually give me zeros and blanks where needed.

    Formula last used: =IF(SUMIFS(H$4:H$7455; $B$4:$B$7455; D7458; $C$4:$C$7455; C7458; H$4:H$7455; ""); ""; SUMIFS(H$4:H$7455; $B$4:$B$7455; D7458; $C$4:$C$7455; C7458))

    Legend:
    H column is one of the datasets
    B column is month-year (like june-2014)
    C column is decade (like I decade, II decade, III decade, as in sets of 10-11 days)
    D7458 is one of the months used as sumif condition
    C7458 is one of the decades used as sumif condition

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Ignore blanks in calculation

    If you want to include 0 but exclude blanks, you need to test for =0 and <>""

    I am not sure which criteria ranges you need to test this for
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    11-13-2019
    Location
    Tallinn, Estonia
    MS-Off Ver
    2016
    Posts
    6

    Re: Ignore blanks in calculation

    Well, the tricky part is that (which so far I haven't got) I need to have sum of zero, where the sum is actually zero and sum of blank, where there is nothing to sum up. I got the blanks, but that also made all zeros into blanks, but some zeros are actual zeros, not blanks.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Ignore blanks in calculation

    To best describe or illustrate your problem you would be better off attaching a dummy workbook. The workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.

  5. #5
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,453

    Re: Ignore blanks in calculation

    Try playing around with the ISNUMBER function which will count 0's and the ISBLANK function which will count empty cells ( it will NOT count cells containing a null text string like "")

  6. #6
    Registered User
    Join Date
    11-13-2019
    Location
    Tallinn, Estonia
    MS-Off Ver
    2016
    Posts
    6

    Re: Ignore blanks in calculation

    Here is dummy file. I put two months of random numbers (lets just say that those are daily precipitation data). What I need:

    1) Sum for all decades (e.g. June 1st decade, June 2nd decade, etc) separate so that it includes all values (including negatives, since I have discovered some in the actual data and negative rainfall might be a thing, but exclude all blanks in a manner that the sum also would be blank.
    2) Sum for monthly data as well in same fashion as for decades data.
    Attached Files Attached Files
    Last edited by Brutus32; 11-18-2019 at 01:14 PM.

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,141

    Re: Ignore blanks in calculation

    Is this what you mean???

    In K2:
    =IFERROR(INDEX(B:B,AGGREGATE(15,6,ROW($B$2:$B$62)/(COUNTIFS($K$1:$K1,$B$2:$B$62,$L$1:$L1,$C$2:$C$62)=0),1)),"")

    In L2:
    =IFERROR(INDEX(C:C,AGGREGATE(15,6,ROW($B$2:$B$62)/(COUNTIFS($K$1:$K1,$B$2:$B$62,$L$1:$L1,$C$2:$C$62)=0),1)),"")

    In M2:
    =IF(K2="","",SUMPRODUCT(($B$2:$B$62=K2)*($C$2:$C$62=L2)*$E$2:$I$62))

    with a similar formula for monthyl totals.
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  8. #8
    Registered User
    Join Date
    11-13-2019
    Location
    Tallinn, Estonia
    MS-Off Ver
    2016
    Posts
    6

    Re: Ignore blanks in calculation

    Not quite. The formula might work (?), but I also need that very same data by stations as separate units. Forgot to mention this earlier.

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,141

    Re: Ignore blanks in calculation

    An insignificant detail (!!!???).
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    11-13-2019
    Location
    Tallinn, Estonia
    MS-Off Ver
    2016
    Posts
    6

    Re: Ignore blanks in calculation

    "Totally" insignificant. I can see the frustation in those question marks and exclamations. However, thank you for the help. One more thing to ask:

    I made some changes to dummy file, what I need that sums of zeros are actually zeros, but blank sums remain blanks
    Attached Files Attached Files

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,141

    Re: Ignore blanks in calculation

    Not sure about that. I'll need to let that ferment in my head for a while.

  12. #12
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,141

    Re: Ignore blanks in calculation

    In M2, copied across and down:
    =IFERROR(IF(SUMPRODUCT(--(LEN(INDEX(E:E,AGGREGATE(15,6,ROW(E$2:E$62)/(($B$2:$B$62=$K2)*($C$2:$C$62=$L2)),1)):INDEX(E:E,AGGREGATE(14,6,ROW(E$2:E$62)/(($B$2:$B$62=$K2)*($C$2:$C$62=$L2)),1)))>0))=0,"",SUMPRODUCT(($B$2:$B$62=$K2)*($C$2:$C$62=$L2)*E$2:E$62)),"")

    In T2, copied across and down:
    =IFERROR(IF(SUMPRODUCT(--(LEN(INDEX(E:E,AGGREGATE(15,6,ROW(E$2:E$62)/($D$2:$D$62=$S2),1)):INDEX(E:E,AGGREGATE(14,6,ROW(E$2:E$62)/($D$2:$D$62=$S2),1)))>0))=0,"",SUMPRODUCT(($D$2:$D$62=$S2)*E$2:E$62)),"")
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    11-13-2019
    Location
    Tallinn, Estonia
    MS-Off Ver
    2016
    Posts
    6

    Re: Ignore blanks in calculation

    I would spread you more rep, if I could, because that is awesome! Thank you!

  14. #14
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,453

    Re: Ignore blanks in calculation

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a relatively new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  15. #15
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,141

    Re: Ignore blanks in calculation

    Brutus32, one final word. The above solution wil work ONLY if the data are sorted, as per your example, with all values (whether real or null) for each month/decade are adjacent to each other. If they are NOT, you will need to sort them frst to bring them adjacent.

+ 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. Replies: 1
    Last Post: 08-06-2019, 10:43 PM
  2. [SOLVED] How to ignore blanks and get rid of error #value
    By RachA12 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-16-2018, 05:34 AM
  3. ignore blanks
    By Patcheen in forum Excel General
    Replies: 7
    Last Post: 07-21-2017, 08:53 AM
  4. Ignore the blanks
    By ailismanzoni in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 01-19-2017, 08:41 AM
  5. Ignore Blanks and Zeros
    By Alan_Bernardo in forum Excel General
    Replies: 3
    Last Post: 01-02-2017, 01:05 PM
  6. VBA code finds blanks, but how to write VBA to ignore non blanks?
    By hopegriffin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-20-2016, 10:51 AM
  7. [SOLVED] MIN/MAX IF To Ignore Blanks
    By splendidus in forum Excel General
    Replies: 2
    Last Post: 07-04-2012, 04:00 PM

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