+ Reply to Thread
Results 1 to 3 of 3

Issue with Countif formula when used in table

  1. #1
    Registered User
    Join Date
    01-12-2016
    Location
    ny
    MS-Off Ver
    2016
    Posts
    10

    Issue with Countif formula when used in table

    I'm building a spreadsheet and need to use countif to create a number for each instance of a value. I usually do this by using a countif formula to count all of the instances above it, like this:
    =COUNTIF(A$2:A2,A2)
    And as a drag this formula down, the range expands accordingly, so I would end up with:


    ITEM #
    APPLE 1
    APPLE 2
    APPLE 3
    APPLE 4
    ORANGE 1
    APPLE 5
    ORANGE 2
    ORANGE 3

    I want to use a formula like this in a table, so when the user makes an new entry in the item column, the formula for # is automatically filled in. However, every time I add a new row, the formula changes.

    When I add a New value in A3, the formula I have in B2:
    =COUNTIF(A$2:A2,A2)
    automatically changes to
    =COUNTIF(A$2:A4,A3)

    And the new formula in B3 becomes
    =COUNTIF(A$2:A4,A3)
    as opposed to the one I expect:
    =COUNTIF(A$2:A3,A3)

    Anyone ever experience this or have a workaround or suggestion? Thanks so much

  2. #2
    Forum Expert
    Join Date
    10-02-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    1,222

    Re: Issue with Countif formula when used in table

    Without a sample file its hard to say whats causing the problem
    Ways to get help: Post clear questions, explain your overall goal, supply as much background as possible, respond to questions asked of you by those trying to help and post sample(s) files.

    "I am here to help, not do it for people" -Me

  3. #3
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Issue with Countif formula when used in table

    If you're going to use a table, it's better to convert to structured referencing if possible. Assuming your first column is called Item, you could use
    =COUNTIF(INDEX([Item],1):[@Item],[@Item])
    Don
    Please remember to mark your thread 'Solved' when appropriate.

+ 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] Issue with adding an actual value to a countif TODAY formula
    By yourik in forum Excel General
    Replies: 10
    Last Post: 09-02-2017, 11:38 PM
  2. Complicated COUNTIF formula in table
    By nickyowen99 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-15-2014, 04:36 AM
  3. [SOLVED] COUNTIF Formula in a Table
    By Denzil_01224 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-05-2014, 08:56 AM
  4. [SOLVED] COUNTIF Formula Issue
    By ARGK in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-09-2013, 08:28 AM
  5. [SOLVED] Issue with COUNTIF formula
    By domnisignis18 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-22-2012, 09:44 AM
  6. Excel 2007 : Countif formula issue
    By John Stoker in forum Excel General
    Replies: 1
    Last Post: 11-16-2011, 10:57 AM
  7. Pivot Table Formula-- COUNTIF?
    By svaiskau in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-06-2007, 10:23 AM

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