+ Reply to Thread
Results 1 to 7 of 7

Cell Reference COUNTIFS & XLOOKUP

  1. #1
    Registered User
    Join Date
    07-24-2023
    Location
    Kansas
    MS-Off Ver
    Office 365
    Posts
    4

    Cell Reference COUNTIFS & XLOOKUP

    I have a problem with countifs cell references moving when I use the sort function in the Sort & Filter (from the Editing tools). I have a data set containing 19 columns and 45 rows of data. I pull data into the table using a combination of sumifs and countifs statements depending on the data type.

    The primary cell reference follows all of the sumifs statements regardless of how I sort the data (using the column filters). The primary cell reference does not follow the countifs statements ? every time I sort using the column filters to sort, the primary cell reference sticks to the content of the original cell, so the cell reference ends up offset from the intended cell.

    I've also had the same problem with an xlookup statement as well.

    I just don?t understand why it works sometimes, and misbehaves other times.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,613

    Re: Cell Reference COUNTIFS & XLOOKUP

    Fast answers need visual help. Please read the yellow banner at the top of this page on how to attach a file and a mocked up solution.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    07-24-2023
    Location
    Kansas
    MS-Off Ver
    Office 365
    Posts
    4

    Re: Cell Reference COUNTIFS & XLOOKUP

    Sorry - hopefully this sample data is not to large
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    07-24-2023
    Location
    Kansas
    MS-Off Ver
    Office 365
    Posts
    4

    Re: Cell Reference COUNTIFS & XLOOKUP

    The columns in yellow highlight are the columns that follow when I sort the range by Sales $ (or any other column)

  5. #5
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,647

    Re: Cell Reference COUNTIFS & XLOOKUP

    As for the columns highlighted in yellow you might try the following:
    1. Convert the range A10:R22 into an Excel table
    2. Use the following in cell P11 and down: =COUNTIFS('Cost Data'!$C$4:$C$25,[@[Supplier Name]],'Cost Data'!$H$4:$H$25,"Yes")
    3. Use the following in cell Q11 and down: =COUNTIFS('Cost Data'!$C$4:$C$25,[@[Supplier Name]],'Cost Data'!$H$4:$H$25,"Yes",'Cost Data'!$I$4:$I$25,">0")
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  6. #6
    Registered User
    Join Date
    07-24-2023
    Location
    Kansas
    MS-Off Ver
    Office 365
    Posts
    4

    Re: Cell Reference COUNTIFS & XLOOKUP

    Thanks for the solution JeteMc! I'll try this. Any thoughts on why this is an issue sometimes but not in all cases?

  7. #7
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,647

    Re: Cell Reference COUNTIFS & XLOOKUP

    I don't know why SUMIFS and COUNTIFS work differently in this situation, although I can see that they do.
    I don't have XLOOKUP in the 2019 version of Excel so can't test that one.

+ 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] XLOOKUP and COUNTIFS?
    By ExcelDavid4 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-07-2022, 03:26 PM
  2. [SOLVED] Countifs, reference cell and countifs from multiple tabs
    By rayted in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-22-2022, 04:30 AM
  3. Countifs using reference in cell
    By Demogorgan in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 12-02-2020, 05:03 AM
  4. Countifs - Add 1 to Cell Reference
    By jbolduc in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-31-2017, 12:44 PM
  5. [SOLVED] Sumproduct to replace countifs as countifs don't work on external source reference
    By KrishnaSagar in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-02-2017, 02:33 AM
  6. countifs not working with cell reference
    By Trig79 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-18-2013, 07:07 AM
  7. Countifs to get criteria from a cell reference
    By SeanKosmann in forum Excel General
    Replies: 2
    Last Post: 01-27-2011, 11:00 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