Results 1 to 6 of 6
  1. #1
    Star Lounger
    Join Date
    Jan 2001
    Location
    Adelaide, South Australia, Australia
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Array function oddity (Excel 2000 SR1)

    I just tried to use the array formula:
    <pre> {=SUM(IF(A1:A65536="",0,1))}</pre>

    to count up the non-blank cells in column A.

    Excel helpfully translated A1:A65536 to A:A and then gave a #NUM error.

    Using <pre> {=SUM(IF(A1:A65535="",0,1))}</pre>

    (omitting the final cell from the range) works fine!

    Is this a bug or a feature <img src=/S/dizzy.gif border=0 alt=dizzy width=15 height=15> ?

    Ian.

  2. #2
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Array function oddity (Excel 2000 SR1)

    Definitely a featbug.

    Why not

    =65536-COUNTBLANK(A:A)

    ? <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    Array formula

    {=SUM(NOT(ISBLANK(A:A))*1)}

    also works now and for those future Excel versions with 1,048,576 rows.
    -John ... I float in liquid gardens
    UTC -7ąDS

  3. #3
    Star Lounger
    Join Date
    Jan 2001
    Location
    Adelaide, South Australia, Australia
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Array function oddity (Excel 2000 SR1)

    Thanks, John. I didn't know about COUNTBLANK.
    <pre>=ROWS(A:A)-COUNTBLANK(A:A)</pre>

    avoids hardwiring 65536.

    Ian.

  4. #4
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Array function oddity (Excel 2000 SR1)

    Whoops! How did I forget ROWS() when I was using it in a formula an hour before that post!
    -John ... I float in liquid gardens
    UTC -7ąDS

  5. #5
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,055
    Thanks
    2
    Thanked 417 Times in 346 Posts

    Re: Array function oddity (Excel 2000 SR1)

    Of course, if you don't mind including formulae in column A that return nul results, you could use:
    =COUNTA(A:A)
    (non-array)
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  6. #6
    Star Lounger
    Join Date
    Jan 2001
    Location
    Adelaide, South Australia, Australia
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Array function oddity (Excel 2000 SR1)

    Thanks, macropod.

    It just goes to confirm that there are always 100 different ways to do anything in Office and 95 of them can be found only by asking in Woody's Lounge! <img src=/S/thankyou.gif border=0 alt=thankyou width=40 height=15>

    All the best
    Ian. <img src=/S/flags/Australia.gif border=0 alt=Australia width=30 height=18>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •