+ Reply to Thread
Results 1 to 13 of 13

Count empty spaces between entries

  1. #1
    Forum Contributor
    Join Date
    09-08-2010
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    125

    Count empty spaces between entries

    I need to count the number of empty spaces between entries in column A and display them as shown in column C. I have spent a lot of time trying to work out how to do this with no luck so far. Can any help?
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,903

    Re: Count empty spaces between entries

    In C1 copied down:

    =IF(A1="","",IFERROR(MATCH(1,SIGN(A2:$A36),0)+IF(ROW()=1,0,1),MATCH(99^99,B:B)-ROW()+1))
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    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,054

    Re: Count empty spaces between entries

    Does that give the expected answer??

    maybe this:

    =IF(A1<>"",IFERROR(INDEX(ROW($A2:$A$36),MATCH(TRUE,INDEX(($A2:$A$36<>0),0),0)),1+LOOKUP(2,1/($B$1:$B$36<>""),ROW(B$1:$B$36)))-ROW(),"")
    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.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  4. #4
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Count empty spaces between entries

    Try this. In C1 then copy down.

    =IF(A1="","",IFERROR(AGGREGATE(15,6,ROW($A2:$A100)/($A2:$A100<>""),1)-ROW($A1),COUNTA($B1:$B$100)))
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  5. #5
    Forum Contributor
    Join Date
    09-08-2010
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    125

    Re: Count empty spaces between entries

    Thank you all for replying, I appreciate it. AliGW, that didn't work it adds the results together from bottom to top. Glenn Kennedy and kvsrinivasamurthy, thank you both formulas work and have solved my problem.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,903

    Re: Count empty spaces between entries

    It gave the same results as your sample file when I put it together this morning.

  7. #7
    Forum Contributor
    Join Date
    09-08-2010
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    125

    Re: Count empty spaces between entries

    I just tested it again and it gives the result from top to bottom, 36, 27, 21 and 14. It should be 9, 7, 7, 14. See Example 2 attached.
    Attached Files Attached Files

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,903

    Re: Count empty spaces between entries

    As I said, it was working this morning. I can’t test it now - I will look again tomorrow.

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,903

    Re: Count empty spaces between entries

    Yes, it's working here (in column C), but I have a feeling it's because I have the insider version of Office 365. I see things like this sometimes with array formulae, so all I can suggest is that you try entering it with CTRL+SHIFT+ENTER.

    Excel 2016 (Windows) 32 bit
    A
    B
    C
    D
    E
    1
    15/07/19
    4559
    9
    9
    IF(A1="","",IFERROR(MATCH(1,SIGN(A2:$A36),0)+IF(ROW()=1,0,1),MATCH(99^99,B:B)-ROW()+1))
    2
    4558
    3
    4557
    4
    4556
    5
    4555
    6
    4554
    7
    4553
    8
    4552
    9
    4551
    10
    13/07/19
    4550
    7
    7
    11
    4549
    12
    4548
    13
    4547
    14
    4546
    15
    4545
    16
    12/07/19
    4544
    8
    7
    17
    4543
    18
    4542
    19
    4541
    20
    4540
    21
    4539
    22
    4538
    23
    11/07/19
    4537
    14
    14
    24
    4536
    25
    4535
    26
    4534
    Sheet: Sheet1

    It should be 9, 7, 7, 14
    The third value is incorrect.
    Attached Files Attached Files
    Last edited by AliGW; 08-03-2019 at 03:15 AM.

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,903

    Re: Count empty spaces between entries

    Having reviewed my workbook, I realise that the formula was slightly off - it was adding one to all values except the first and last.

    This will give the correct results:

    =IF(A1="","",IFERROR(MATCH(1,SIGN(A2:$A36),0),MATCH(99^99,B:B)-ROW()+1))

    ... confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.

  11. #11
    Forum Contributor
    Join Date
    09-08-2010
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    125

    Re: Count empty spaces between entries

    Hi AliGW, yes that formula works, thanks.

  12. #12
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,913

    Re: Count empty spaces between entries

    Or try this the formula in C1 and copy down:

    =IF(A1="","",COUNTA(B1:$B$37)-SUM(C2:$C$37))

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,903

    Re: Count empty spaces between entries

    Very slick - and obvious when you see it!!!

+ 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: 9
    Last Post: 12-31-2018, 01:29 PM
  2. [SOLVED] Counting Spaces Between Entries
    By RachelMads02 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 03-27-2017, 11:50 AM
  3. [SOLVED] Drop down list. Entries including numbers and spaces
    By kollsvein in forum Excel General
    Replies: 15
    Last Post: 04-07-2015, 04:08 AM
  4. [SOLVED] Empty Cells apparently have spaces
    By Sam Capricci in forum Access Tables & Databases
    Replies: 13
    Last Post: 03-02-2015, 12:55 PM
  5. How to keep spaces between $ and other digits in cell entries?
    By Mirisage in forum Excel - New Users/Basics
    Replies: 9
    Last Post: 09-03-2013, 05:27 PM
  6. How can I ensure entries in a column are 16 chars long using spaces?
    By compact in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-18-2007, 06:11 AM
  7. deleting empty spaces
    By vrijbergen in forum Excel General
    Replies: 1
    Last Post: 10-03-2005, 08:05 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