+ Reply to Thread
Results 1 to 18 of 18

Formula/Function Required to Count Blank Cells in a Dynamic Range

  1. #1
    Registered User
    Join Date
    07-10-2014
    Location
    Sheffield, England
    MS-Off Ver
    2007
    Posts
    9

    Formula/Function Required to Count Blank Cells in a Dynamic Range

    Good afternoon,

    I am having difficulty in creating a formula which will count how many blank cells are in one column. The data and number of rows is constantly increasing and decreasing based on what data is returned.

    So for example, cells A1:A30 will contain a mixture of cells containing text and blank cells. Then next month, the cell range could be A1:A45 but containing the same type of data.

    I understand that I will need to configure the name of the range to make it dynamic using the offset function, but after that I am drawing a blank on how to execute the formula to count the blanks. Am I getting confused by applying the formula within the offset, or do I need to do it a different way?

    Any help would be most appreciated.

    Thanks!

    Matt

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Formula/Function Required to Count Blank Cells in a Dynamic Range

    Try this...

    Create the dynamic range.

    Name: MyRange (or whatever you want to name it)

    Refers to:

    =$A$1:INDEX($A:$A,MATCH("zzzzz",$A:$A))

    Then, if your data looks like this:

    Data Range
    A
    1
    text
    2
    3
    4
    text
    5
    6
    7
    8
    9
    text
    10
    11
    12
    13
    14
    15


    To count the empty cells within the dynamic range of MyRange:

    =COUNTBLANK(MyRange)

    Result = 6

    In this case the dynamic range evaluates to A1:A9. From A1 to the last (bottom-most) TEXT entry, cell A9.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    07-10-2014
    Location
    Sheffield, England
    MS-Off Ver
    2007
    Posts
    9

    Re: Formula/Function Required to Count Blank Cells in a Dynamic Range

    Hi Tony,

    That is perfect, works exactly as I need it to, so thank you very much!

    Quick question, there will be a circumstance where the last cell of the range will be a blank, which I will need it to count. Is there a way around this issue using the formula?

    Thanks

    Matt

  4. #4
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Thumbs up Re: Formula/Function Required to Count Blank Cells in a Dynamic Range

    Hey man,

    Got the solution...
    It is automatic...
    check the attachment...




    Say thanks, click *
    Attached Files Attached Files

  5. #5
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: Formula/Function Required to Count Blank Cells in a Dynamic Range

    Hi Matty,
    The above attachment includes the solution to your second query as well...



    Click *, If helped...

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Formula/Function Required to Count Blank Cells in a Dynamic Range

    Quote Originally Posted by MattyD89 View Post
    Hi Tony,

    That is perfect, works exactly as I need it to, so thank you very much!

    Quick question, there will be a circumstance where the last cell of the range will be a blank, which I will need it to count. Is there a way around this issue using the formula?
    Is this a special circumstance or should it always apply?

    If it should always apply just add 1 to the MATCH function:

    =$A$1:INDEX($A:$A,MATCH("zzzzz",$A:$A)+1)

    With this data:

    Data Range
    A
    1
    text
    2
    3
    4
    text
    5
    6
    7
    8
    9
    text
    10
    11
    12
    13
    14
    15


    The dynamic range MyRange now evaluates to A1:A10.

    =COUNTBLANK(MyRange) = 7

  7. #7
    Registered User
    Join Date
    07-10-2014
    Location
    Sheffield, England
    MS-Off Ver
    2007
    Posts
    9

    Re: Formula/Function Required to Count Blank Cells in a Dynamic Range

    Hi Tony,

    That's great, thank you very much.

    It should always apply, but until I receive the data, I don't know how many blanks the range could end with. For example, one week it could be ending in one blank and the next week it could be ending in 4.

    Will the change to the formula count just the one extra blank?

    Thanks

    Matt

  8. #8
    Registered User
    Join Date
    07-10-2014
    Location
    Sheffield, England
    MS-Off Ver
    2007
    Posts
    9

    Re: Formula/Function Required to Count Blank Cells in a Dynamic Range

    Hi Tony,

    That's great, thank you very much.

    It should always apply, but until I receive the data, I don't know how many blanks the range could end with. For example, one week it could be ending in one blank and the next week it could be ending in 4.

    Will the change to the formula count just the one extra blank?

    Thanks

    Matt

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Formula/Function Required to Count Blank Cells in a Dynamic Range



    OK, now I'm officially confused!

    I don't understand how you determine a range to be either 1 or 4 empty cells after the last non-empty cell. Is there a non-empty cell in another column that is used to determine the end of the range?

  10. #10
    Registered User
    Join Date
    07-10-2014
    Location
    Sheffield, England
    MS-Off Ver
    2007
    Posts
    9

    Re: Formula/Function Required to Count Blank Cells in a Dynamic Range

    Sorry to confuse you!

    An example would be if I was to receive 120 rows of data (A1:A120), the column would contain various text answers with some blank cells where they could not answer. The last 4 or 5 rows of the 120 might not answer and the cells would be blank, but I still need to calculate how many blank cells are in the range (A1:A120). Is this making any more sense? If not I can create an example and upload it, if I can?

    Also, this formula will be repeated across other ranges that I will need to calculate blank cells for. I have tried to work with your formula to increase the range (So instead of doing it for 1 column, doing it for 4 or 5) and am having difficulty with trying to expand it to include the range I need it to be.

    Any help you can offer would be fantastic, you have already helped substantially so far .

    Matt

  11. #11
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Formula/Function Required to Count Blank Cells in a Dynamic Range

    Quote Originally Posted by MattyD89 View Post
    Is this making any more sense?
    Not to me!

    If not I can create an example and upload it, if I can?
    Yes, that will help. Just make it a SMALL sample file!

  12. #12
    Registered User
    Join Date
    07-10-2014
    Location
    Sheffield, England
    MS-Off Ver
    2007
    Posts
    9

    Re: Formula/Function Required to Count Blank Cells in a Dynamic Range

    Apologies again Tony!

    Please see attached, If you need me to explain anything else again, just let me know.

    Thanks again!

    Matt
    Attached Files Attached Files

  13. #13
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Formula/Function Required to Count Blank Cells in a Dynamic Range

    Can you tell me what result you expect based on the sample file?

    You have cell borders down to row 16 so I assume you want to count down to that row?

    Other than the borders, I don't see anything that can be used to define the range down to row 16. That's 2 rows below the last data cell.
    Last edited by Tony Valko; 07-11-2014 at 11:14 AM.

  14. #14
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Formula/Function Required to Count Blank Cells in a Dynamic Range

    Or, maybe this is what you want...

    Data Range
    A
    B
    C
    1
    No
    No
    Yes
    2
    No
    Yes
    Yes
    3
    ------
    No
    No
    4
    No
    Yes
    5
    No
    Yes
    ------
    6
    Yes
    ------
    Yes
    7
    No
    Yes
    Yes
    8
    No
    Yes
    9
    Yes
    No
    Yes
    10
    No
    Yes
    Yes
    11
    No
    No
    12
    No
    No
    13
    No
    Yes
    14
    15
    No


    All the columns get counted down to row 15 because row 15 is the last row that contains an entry?

    So, count of empty cells is:

    A1:A15 = 5
    B1:B15 = 3
    C1:C15 = 5

  15. #15
    Registered User
    Join Date
    07-10-2014
    Location
    Sheffield, England
    MS-Off Ver
    2007
    Posts
    9

    Re: Formula/Function Required to Count Blank Cells in a Dynamic Range

    Hi Tony,

    The expected result would be 12 blanks. I would need it to count to row 16, even if cells A14:C15 in your example contained no data as it would indicate that the question was not answered and needs to be counted as a no answer.

  16. #16
    Registered User
    Join Date
    07-10-2014
    Location
    Sheffield, England
    MS-Off Ver
    2007
    Posts
    9

    Re: Formula/Function Required to Count Blank Cells in a Dynamic Range

    Hi Tony,

    The expected result would be 12 blanks. I would need it to count to row 16, even if cells A14:C15 in your example contained no data as it would indicate that the question was not answered and needs to be counted as a no answer.

  17. #17
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,915

    Re: Formula/Function Required to Count Blank Cells in a Dynamic Range

    find the attached file
    one additional column was inserted
    Attached Files Attached Files
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  18. #18
    Registered User
    Join Date
    07-10-2014
    Location
    Sheffield, England
    MS-Off Ver
    2007
    Posts
    9

    Re: Formula/Function Required to Count Blank Cells in a Dynamic Range

    That's fantastic, thanks Siva!

+ 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. Formula to Count Consecutive Blank Cells in a Range Depending on Today's Date
    By tophatpete in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 11-28-2020, 05:12 AM
  2. [SOLVED] Macro to copy formula to blank cells in a dynamic range
    By masben in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-25-2013, 07:07 AM
  3. Replies: 2
    Last Post: 06-14-2012, 01:44 PM
  4. Advanced filter with blank cells / Dynamic named range with blank cells
    By Jason_2112 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-15-2010, 12:06 PM
  5. Replies: 2
    Last Post: 04-13-2010, 02:52 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