+ Reply to Thread
Results 1 to 10 of 10

Exclude empty cells from a calculation

Hybrid View

Andrew87.. Exclude empty cells from a... 01-03-2015, 07:56 AM
zbor Re: Exclude empty cells from... 01-03-2015, 08:35 AM
sktneer Re: Exclude empty cells from... 01-03-2015, 08:39 AM
Andrew87.. Re: Exclude empty cells from... 01-03-2015, 08:40 AM
sktneer Re: Exclude empty cells from... 01-03-2015, 08:42 AM
Andrew87.. Re: Exclude empty cells from... 01-03-2015, 09:17 AM
sktneer Re: Exclude empty cells from... 01-03-2015, 09:32 AM
Andrew87.. Re: Exclude empty cells from... 01-03-2015, 09:42 AM
martindwilson Re: Exclude empty cells from... 01-03-2015, 11:19 AM
Andrew87.. Re: Exclude empty cells from... 01-03-2015, 11:28 AM
  1. #1
    Registered User
    Join Date
    01-03-2015
    Location
    Europe
    MS-Off Ver
    2013
    Posts
    40

    Exclude empty cells from a calculation

    Hi,

    would you be so kind and assist me with updating my formula to not count empty cells?

    =SUMPRODUCT(1/COUNTIF(G2:G51;G2:G51)*(J2:J51=N2))

    I would like to have amount of unique values based on another criteria. Row G would be G2:G2000, however cells below G51 are currently empty and formula would show an error.

    Thank you very much.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,043

    Re: Exclude empty cells from a calculation

    Does this works:

    Formula: copy to clipboard
    =SUMPRODUCT((J2:J2000=N2)*(G2:G2000<>"")/COUNTIF(G2:G2000,G2:G2000&"")) 
    Never use Merged Cells in Excel

  3. #3
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: Exclude empty cells from a calculation

    Or you may use IFERROR to exclude errors like this.....

    =SUMPRODUCT(IFERROR(1/COUNTIF(G2:G2000,G2:G2000)*(J2:J2000=N2),0))
    Don't forget to confirm it with Ctrl+Shift+Enter instead of just Enter as this is an Array Formula.

    Does this help?
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  4. #4
    Registered User
    Join Date
    01-03-2015
    Location
    Europe
    MS-Off Ver
    2013
    Posts
    40

    Re: Exclude empty cells from a calculation

    Both solutions work. Thank you very much to both of you!

  5. #5
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: Exclude empty cells from a calculation

    You're welcome. Glad we could help.
    If that takes care of your question, please mark your thread as Solved by selecting Thread Tools (just above your first post) --> Mark thread as solved.

  6. #6
    Registered User
    Join Date
    01-03-2015
    Location
    Europe
    MS-Off Ver
    2013
    Posts
    40

    Re: Exclude empty cells from a calculation

    It created an issue though, if a number in G row is present in multiple dates (J row) , results are slightly inaccurate, such as 59.833 instead of what should be 62. Is there a way for the unique values would be counted every time for specific date (J row) ? So let's say number 1000 is present under 20th and 21st december and I would this number to be counted as unique under both. I hope I am explaining it well enough.

    Thanks in advance.

  7. #7
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: Exclude empty cells from a calculation

    Maybe this Array Formula (requires CSE)

    =SUMPRODUCT(IFERROR(1/COUNTIFS(G2:G2000,G2:G2000,J2:J2000,N2)*(J2:J2000=N2),0))

  8. #8
    Registered User
    Join Date
    01-03-2015
    Location
    Europe
    MS-Off Ver
    2013
    Posts
    40

    Re: Exclude empty cells from a calculation

    You are a star. Thanks again. Thread solved.

  9. #9
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Exclude empty cells from a calculation

    am i missing something i get non integers as answers how can unique count be 2.5?
    Attached Files Attached Files
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  10. #10
    Registered User
    Join Date
    01-03-2015
    Location
    Europe
    MS-Off Ver
    2013
    Posts
    40

    Re: Exclude empty cells from a calculation

    Hi,

    in J I have this formula: =IF(G52>1;J51;"") it adds date from the above cell. The formulas above count correctly in my case as when cell G is filled in, J gets filled in automatically.

+ 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. VBA modification to exclude empty cells, just need help implementing!!
    By cronerd in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-09-2013, 12:32 PM
  2. Excel 2007 : exclude empty cells
    By maniac099 in forum Excel General
    Replies: 7
    Last Post: 06-17-2012, 10:53 AM
  3. Exclude empty cells
    By klund in forum Excel General
    Replies: 10
    Last Post: 05-05-2009, 06:42 AM
  4. [SOLVED] How do I exclude empty cells from being printed?
    By pox in forum Excel General
    Replies: 1
    Last Post: 08-13-2005, 07:05 AM
  5. How to exclude cells that are empty?
    By aijihz in forum Excel General
    Replies: 1
    Last Post: 03-30-2005, 02:06 AM

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