+ Reply to Thread
Results 1 to 4 of 4

Counta(Offset...)) works in cell but not named formula; cell references are not relative.

  1. #1
    Registered User
    Join Date
    10-05-2012
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    2

    Counta(Offset...)) works in cell but not named formula; cell references are not relative.

    Hi everyone,

    I have created many dynamic named ranges in the past, but this one is giving me trouble.

    I have a list that begins in cell A4 for now. The rows above are reserved for the subtotal(109,range) function to be used with autofilter below. Column A:A is the column to calculate range height via the Counta function. There are currently some blank cells above the list which may or may not get filled in by my boss. She may also want to insert extra rows above for additional computations. So I am attempting to subtract from Counta($A$A) any non-blank cells in that column above the list. This formula gives the correct count when I place it in a cell, but returns "1" when I assign it to a named formula: =COUNTA(OFFSET(Stores!$A$4,-(ROW(Stores!$A$4)-1),0,ROW(Stores!$A$4)-1,1)). Locking cells and protecting the worksheet is a last resort.

    I am using Excel 2013 on machine running Windows 7

    Thank you for any help you can provide!

  2. #2
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Counta(Offset...)) works in cell but not named formula; cell references are not relati

    Hi,

    If you use your above formula in name range object, the argument of counta() function is not evaluated yet as a range object, so :

    Please Login or Register  to view this content.
    is equal to :

    Please Login or Register  to view this content.
    Both will yield 1 (the number of counta() arguments)


    Another example :

    Please Login or Register  to view this content.
    is equal to :

    Please Login or Register  to view this content.
    Both will yield 3 (the number of counta() arguments)


    You should use indirect assignment like this :

    - First, create a name range object, let's say it is Range1
    Please Login or Register  to view this content.
    - Then, because this Range1 has already evaluated, you can use it as argument for counta() in a new name range object. Let's say it is RangeA
    Please Login or Register  to view this content.
    Now, when you call this name (=RangeA), it should show the expected result.

    Regards
    Last edited by JBeaucaire; 12-12-2014 at 03:31 PM. Reason: Removed reference to CODE TAGS, not relevant to this thread.
    1. I care dog
    2. I am a loop maniac
    3. Forum rules link : Click here
    3.33. Don't forget to mark the thread as solved, this is important

  3. #3
    Registered User
    Join Date
    10-05-2012
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    2

    Re: Counta(Offset...)) works in cell but not named formula; cell references are not relati

    Thank you Karedog; you solved it! And thanks for the explanation, examples, (and reminder re posting code).

    When creating named formulas, I will take note when a formula expects a value versus a range and plan accordingly. (I need to learn how Excel calculates Named Formulas differently from formulas in cells!)

    Thank you again.

  4. #4
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Counta(Offset...)) works in cell but not named formula; cell references are not relati

    You are welcome January1 and many thanks for the reputation point.

    Regards

+ 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] Offset Function works in cell, not in named range
    By DragonslayerApps in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 07:05 AM
  2. [SOLVED] Offset Function works in cell, not in named range
    By DragonslayerApps in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM
  3. Offset Function works in cell, not in named range
    By DragonslayerApps in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 AM
  4. Offset Function works in cell, not in named range
    By DragonslayerApps in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 11:05 PM
  5. Offset Function works in cell, not in named range
    By DragonslayerApps in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 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