+ Reply to Thread
Results 1 to 11 of 11

Need to count blank cells in a column, with a twist

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    01-25-2014
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    434

    Re: Need to count blank cells in a column, with a twist

    I just did some further tests before closing it down, and found there is a problem with the original formula I posted
    It wasn't coping with balls for the first draw in your data, i.e. on row 2

    This formula now does a check for the first row of data

    =IF(AND(ROW()=2,A2="x"),0,IF(A2="","",ROW()-1-COUNTIF(A$2:A2,"x")-SUM(B1:B$2)))
    Again, as long as you enter this formula into cell B2 initially, you will be able to copy it down and across without having to make any adjustments to it


    Here is a sample of about the first 50 draws for balls 1 to 10

    1 1B 2 2B 3 3B 4 4B 5 5B 6 6B 7 7B 8 8B 9 9B 10 10B
    X 0
    X 2 X 2
    X 3 X 3 X 3
    X 4
    X 1 X 2
    X 0 X 5
    X 4 X 0
    X 8 X 0 X 3
    X 3
    X 2 X 3 X 0 X 2
    X 12
    X 4
    X 10
    X 1 X 9
    X 12 X 4 X 4
    X 0
    X 5 X 2 X 18
    X 7
    X 4 X 3
    X 2
    X 10 X 0
    X 0
    X 10 X 4 X 8
    X 6 X 7 X 0
    X 1
    X 7 X 0 X 1
    X 5 X 2
    X 4
    X 2
    X 10
    X 5
    X 3 X 6
    X 6
    X 19 X 3
    X 5
    X 11 X 13 X 2
    X 0 X 12 X 4
    X 3
    X 1
    X 2 X 4
    X 4 X 28
    X 1
    X 11 X 0

  2. #2
    Valued Forum Contributor
    Join Date
    03-21-2013
    Location
    cyberia
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: Need to count blank cells in a column, with a twist

    Sub blanks_and_stuff()
    Dim r&, c&, i&, j&, k&, a, u()
    r = Cells.Find("*", , , , xlByRows, xlPrevious).Row
    c = Cells.Find("*", , , , xlByColumns, xlPrevious).Column
    For j = 1 To c Step 2
        a = Cells(2, j).Resize(r)
        ReDim u(1 To r, 1 To 1)
        For i = 1 To r - 1
            If Len(a(i, 1)) = 0 Then
                k = k + 1
            Else
                If k > 0 Then u(i, 1) = k: k = 0
            End If
        Next i
        Cells(2, j + 1).Resize(r) = u
        If Len(a(1, 1)) = 0 Then Cells(j + 1).End(4) = "#NA"
        k = 0
    Next j
    End Sub

+ 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. [SOLVED] count blank cells in one column based on date in different column
    By IreneADS in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-16-2014, 09:58 AM
  2. Count number of cells in column per month, ignore blank cells
    By lamdl in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-13-2014, 08:50 PM
  3. Replies: 2
    Last Post: 10-04-2012, 03:19 PM
  4. Replies: 5
    Last Post: 08-05-2009, 02:43 PM
  5. fill blank cells with twist
    By fatturtle in forum Excel General
    Replies: 0
    Last Post: 04-27-2006, 07:50 PM

Tags for this Thread

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