+ Reply to Thread
Results 1 to 3 of 3

Unknown Rows

  1. #1
    Darren
    Guest

    Unknown Rows

    How do I create a formula to count a varying number of cells in a row. I get
    a file every month and would like to create, as part of a macro, a formula
    that will tell me the number of rows of data. This number would then be used
    for other calculations.

  2. #2
    dlw
    Guest

    RE: Unknown Rows

    use =countif function, the range would be the entire row, like a1:iv1, if
    they are numbers, the criteria would be ">0"
    (see help screen on countif)

    "Darren" wrote:

    > How do I create a formula to count a varying number of cells in a row. I get
    > a file every month and would like to create, as part of a macro, a formula
    > that will tell me the number of rows of data. This number would then be used
    > for other calculations.


  3. #3
    Zack Barresse
    Guest

    Re: Unknown Rows

    Hi Darren,

    Depending on what type of data you had, you could use something like this
    ....

    =COUNTIF($A:$A,"<>")

    If you want to do this in a macro/procedure, you could either use the
    Application.WorksheetFunction.CountA, or if you want the last row, something
    like this ..

    Cells(Rows.Count, "A").End(xlup).Row

    The two will function a little differently with non-contiguous data, beware.
    See a very detailed write up here:
    http://www.xldynamic.com/source/xld.LastValue.html

    HTH

    --
    Regards,
    Zack Barresse, aka firefytr
    To email, remove NOSPAM


    "Darren" <[email protected]> wrote in message
    news:[email protected]...
    > How do I create a formula to count a varying number of cells in a row. I
    > get
    > a file every month and would like to create, as part of a macro, a formula
    > that will tell me the number of rows of data. This number would then be
    > used
    > for other calculations.




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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