+ Reply to Thread
Results 1 to 6 of 6

Dynamic range - ignoring formulas

  1. #1
    Forum Contributor
    Join Date
    01-12-2004
    Location
    Nebraska, USA
    MS-Off Ver
    Office 365
    Posts
    167

    Dynamic range - ignoring formulas

    I use the standard OFFSET-COUNT-MATCH method to create dynamic named ranges in my Excel projects.
    Needless to say, this method won't work on a spreadsheet with formulas extending beyond the current range.
    The count function counts the cells containing formulas, even though they may contain no data.

    Does anyone know how to construct a formula that will IGNORE the "formula only" cells??
    Last edited by HuskerBronco; 12-27-2008 at 09:53 AM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello HuskerBronco,

    You can accomplish this by creating a User Defined Function (UDF). A UDF is a macro you call like a worksheet function. This UDF will count only cells without formulas and that aren't blank.
    Please Login or Register  to view this content.
    Adding the Macro
    1. Copy the macro above pressing the keys CTRL+C
    2. Open your workbook
    3. Press the keys ALT+F11 to open the Visual Basic Editor
    4. Press the keys ALT+I to activate the Insert menu
    5. Press M to insert a Standard Module
    6. Paste the code by pressing the keys CTRL+V
    7. Make any custom changes to the macro if needed at this time.
    8. Save the Macro by pressing the keys CTRL+S
    9. Press the keys ALT+Q to exit the Editor, and return to Excel.

    Sincerely,
    Leith Ross

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    COUNTBLANK function counts both genuinely blank cells and cells with "formula blanks", i.e. ""

    So you could use this formula for the number of cells in column A with data

    =65536-COUNTBLANK(A:A)

  4. #4
    Forum Contributor
    Join Date
    01-12-2004
    Location
    Nebraska, USA
    MS-Off Ver
    Office 365
    Posts
    167
    Thanks for your solutions, guys!!
    Both solutions are excellent, and both worked to perfection.

  5. #5
    Registered User
    Join Date
    10-12-2012
    Location
    seatle
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Dynamic range - ignoring formulas

    I have formulas (some with results, some not) that are all being referenced by the named range when I use,
    =OFFSET(Products!$AA$1,1,0,(65536-COUNTBLANK(Products!$AA:$AA)-1),1)
    =OFFSET(Products!$AA$1,1,0,COUNTA(Products!$AA:$AA)-1,1)

    Pasting values to a new column doesn't seem make a difference.
    1. How can I get this to work with formulas?
    2. How can I implement the UDF suggestion above in conjunction with the named range formula?

  6. #6
    Forum Contributor
    Join Date
    08-02-2013
    Location
    Wageningen, The Netherlands
    MS-Off Ver
    365
    Posts
    495

    Re: Dynamic range - ignoring formulas

    @joel
    Please start your own thread for your own questions, as stated in the forum rules (http://www.excelforum.com/forum-rule...rum-rules.html rule nr 2)
    When I say semicolon, u say comma!

+ 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