+ Reply to Thread
Results 1 to 24 of 24

Using If cell not empty as criteria within a SUMIFS statement

  1. #1
    Registered User
    Join Date
    04-27-2021
    Location
    London
    MS-Off Ver
    v16.48
    Posts
    10

    Using If cell not empty as criteria within a SUMIFS statement

    I'm using the following SUMIFS statement to Sum column N, based on some criteria:
    Criteria 1 - Field in column H = Done
    Criteria 2 - Date in column L >= date specified
    Criteria 3 - Date in column L <= date specified
    Criteria 4 - ????

    =SUMIFS('RAW DATA'!$N$2:$N$999, 'RAW DATA'!$H$2:H$999, "Done", 'RAW DATA'!$L$2:L$999, ">=" &A14, 'RAW DATA'!L$2:L$999,"<=" &B14, 'RAW DATA'!$M$2:M$999, "??????????",)

    For the final criteria, I'm trying to make it that the cell in column M is NOT EMPTY (it has to be populated with something).

    Could someone please help me with the correct syntax for this?

    Thanks

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Using If cell not empty as criteria within a SUMIFS statement

    Try

    =SUMIFS('RAW DATA'!$N$2:$N$999, 'RAW DATA'!$H$2:H$999, "Done", 'RAW DATA'!$L$2:L$999, ">=" &A14, 'RAW DATA'!L$2:L$999,"<=" &B14, 'RAW DATA'!$M$2:M$999, "<>",)

  3. #3
    Registered User
    Join Date
    04-27-2021
    Location
    London
    MS-Off Ver
    v16.48
    Posts
    10

    Re: Using If cell not empty as criteria within a SUMIFS statement

    Thanks John. That doesn't seem to work - it is still counting data from rows where the field in column M is empty.

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Using If cell not empty as criteria within a SUMIFS statement

    Try

    =SUMIFS('Raw data'!$N$2:$N$999, 'Raw data'!$H$2:H999, "Done", 'Raw data'!$L$2:L$999, ">=" &A14, 'Raw data'!L$2:L$999,"<=" &B14, 'Raw data'!$M$2:M$999, ">0")

    I am guessing M is not blank but contains a formula ????

  5. #5
    Registered User
    Join Date
    04-27-2021
    Location
    London
    MS-Off Ver
    v16.48
    Posts
    10

    Re: Using If cell not empty as criteria within a SUMIFS statement

    I couldn't seem to get that to work either

    I've attached my Excel, keeping only the required data. There isn't currently a formula in M - just text.

    The way I'm validating it's not working is by filtering out the blanks in the RAW DATA tab and summing the values in N. The SUM is much less than the SUM I'm getting in Sheet1. Also when I drag the new formula down I don't see any change in the numbers.

    Thanks again for the help.
    Attached Files Attached Files

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Using If cell not empty as criteria within a SUMIFS statement

    How about
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Using If cell not empty as criteria within a SUMIFS statement

    I looked at the results in D16 which has a value of 29

    I filtered the data on January : row 275 has "CAA" in column M and value in N of 2. I deleted the CAA and the result in D16 was 27 i.e it had ignored the the blank M. Similar for row 361: removed "DBW"/ N =20 and result in D16=9 (I had reinstated the "CAA".

    So I don't know what you are doing but the formula works as required.

    =SUMIFS('RAW DATA'!$N$2:$N$999, 'RAW DATA'!$H$2:H$999, "Done", 'RAW DATA'!$L$2:L$999, ">=" &A16, 'RAW DATA'!L$2:L$999,"<=" &B16, 'RAW DATA'!$M$2:M$999, "<>")

  8. #8
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Using If cell not empty as criteria within a SUMIFS statement

    @JohnTopley that formula totals to 485, but if you look at the filtered sheet it should total to 419
    It's ignoring the column M criteria, also as the dates on the Raw Data sheet include time some of them are not being counted.

  9. #9
    Registered User
    Join Date
    04-27-2021
    Location
    London
    MS-Off Ver
    v16.48
    Posts
    10

    Re: Using If cell not empty as criteria within a SUMIFS statement

    Yes, this was the same reason I thought it wasn't working and not taking into account the M criteria. On Sheet1, with the formula, it totals 485, but when I filter with the same criteria on RAW DATA tab it totals 419 so something doesn't add up - it still seems to be counting some of the rows where M is empty.

    Thanks again

  10. #10
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Using If cell not empty as criteria within a SUMIFS statement

    Did you try the formula I suggested?

  11. #11
    Registered User
    Join Date
    04-27-2021
    Location
    London
    MS-Off Ver
    v16.48
    Posts
    10

    Re: Using If cell not empty as criteria within a SUMIFS statement

    Sorry, i completely missed your suggestion - that does work, thank you!

    I'd love to know why the '&B2+1' ? I see that before adding this, the numbers don't add up but I don't understand why it requires that?

    What does the "?*" syntax mean?

    Thanks for the help!

  12. #12
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Using If cell not empty as criteria within a SUMIFS statement

    The ?* looks for any text value that is a minimum of 1 character long, so it ignores the null strings that are in col M.
    The dates in col L contains date & time so on row 23 you have an end date of 7th Mar & there are 5 rows that match that date, but if you swap the format to General you will those rows show
    Excel 2016 (Windows) 32 bit
    L
    125
    44262.93
    132
    44262.93
    208
    44262.93
    226
    44262.93
    262
    44262.93
    Sheet: RAW DATA
    Which means they are all greater than the date alone (44262), so you need to add 1 to the date & use < rather than <=

  13. #13
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Using If cell not empty as criteria within a SUMIFS statement

    The problem is DATA: there are cells in M which appear blank but actual contain "rogue" data,

    If you filter on M=blank, then Clear contents, the total is 396.

    I tested a specific date range where the original result given was 13 but should have been 11. Guess what there was a "blank" M with N=2.

    I cleared the M and result was 11.

  14. #14
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Using If cell not empty as criteria within a SUMIFS statement

    That still does not take into account the fact that the cells contain date and time.

  15. #15
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Using If cell not empty as criteria within a SUMIFS statement

    Removing the time from column L makes no difference to final result.

  16. #16
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Using If cell not empty as criteria within a SUMIFS statement

    It does for me.

  17. #17
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Using If cell not empty as criteria within a SUMIFS statement

    What results did you get?

    I used INT(L) in column K and pasted values back into L.

    I find no reason why this would (does) not work.
    Last edited by JohnTopley; 04-30-2021 at 03:01 PM.

  18. #18
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Using If cell not empty as criteria within a SUMIFS statement

    With the formula I suggested 419, with your formula after cleaning col M 396.
    The only row affected is row 23 where I get 64 rather than 41

  19. #19
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Using If cell not empty as criteria within a SUMIFS statement

    I have just rerun and I now get 419 with 64 in row 23: not sure why I had the other results but now we agree so hopefully all is well!

  20. #20
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Using If cell not empty as criteria within a SUMIFS statement

    so hopefully all is well!
    Agreed.

  21. #21
    Registered User
    Join Date
    04-27-2021
    Location
    London
    MS-Off Ver
    v16.48
    Posts
    10

    Re: Using If cell not empty as criteria within a SUMIFS statement

    Thanks very much for the help - I think I understand it now.

  22. #22
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Using If cell not empty as criteria within a SUMIFS statement

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, 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.

  23. #23
    Registered User
    Join Date
    04-27-2021
    Location
    London
    MS-Off Ver
    v16.48
    Posts
    10

    Re: Using If cell not empty as criteria within a SUMIFS statement

    Sorry, just one more question - how do I find and clear the rogue/hidden data you mention? Do I just filter by the blank cells and hit delete?

  24. #24
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Using If cell not empty as criteria within a SUMIFS statement

    Filter and "Clear Contents" should suffice.

+ 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. Sumifs when data has empty cell
    By bonniewy in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 08-08-2017, 11:13 AM
  2. How to Leave Truly Empty Cell if Criteria for IF statement is FALSE
    By lowprofile in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-02-2014, 01:24 PM
  3. [SOLVED] SUMIFS Function with an OR Statement In One Criteria
    By nevi in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-20-2014, 03:31 AM
  4. Replies: 3
    Last Post: 11-21-2012, 04:57 PM
  5. Replies: 5
    Last Post: 09-07-2011, 11:14 PM
  6. if statement for empty cell
    By CORY in forum Excel General
    Replies: 1
    Last Post: 02-03-2006, 02:30 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