+ Reply to Thread
Results 1 to 7 of 7

Countifs In Array Not Working As Expected, then Update question

  1. #1
    Registered User
    Join Date
    08-28-2013
    Location
    Phoenix, Arizona
    MS-Off Ver
    Excel 2010, 2013
    Posts
    69

    Question Countifs In Array Not Working As Expected, then Update question

    Good Morning or Afternoon,

    First, I've enjoyed looking through all the posts here, it has been very informative!

    My question is related to the Array expression (copied on all fields) on the HR tab of this workbook. I have used this expression in several worksheets to pull the appropriate records and it doesn't seem to be working correctly.

    It is supposed to pull any records that are "" in the HR column from the Data worksheet. I tried modifying the expression to count zeros, no joy. I tried using "<0", no joy. I'm still retrieving columns that have "HR" in the "HR" column. When the actual "HR" person reviews this and makes changes, they don't want results that have been previously reviewed.

    So, having said that, I think this may be a mute point. The spreadsheet is designed for the employee supervisor to enter the absences in the "EnterTime" worksheet. It should update to another table. HR reviews that table and then data will update to the final table once modifications are made. Perhaps I should create the VBA to update records to the HR sheet for review, and then copy finished records to the Data worksheet?

    Forgive me, I'm new at this and have never worked on an application or VBA.

    Thanks so much for input!

    Jan
    Attached Files Attached Files

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Countifs In Array Not Working As Expected, then Update question

    Hi,

    Firsly, I'm not really sure what you're trying to accomplish with this COUNTIFS approach, and I'm not quite sure why you've rejected a simpler IF(Data!$I$1:$I$437=""... clause.

    Secondly, the k value in the SMALL function of your first row is evaluating to 2, which means you are not returning the first match.

    Thirdly, I have to confess I have no idea why you are wrapping some of these returns in UPPER - do you realise that, in so doing, the returns in the Date and Time columns, for example, will result in text entries?

    Fourthly, the use of ROW() and COLUMN() is open to potential error were rows/columns to be inserted in your table, and so can be made more rigorous: try this array in B3 and copy across and down (though I'm still not sure about that UPPER!):

    =IFERROR(UPPER(INDEX(Data!$A$1:$M$437,SMALL(IF(Data!$I$1:$I$437="",ROW(Data!$A$1:$M$437)-MIN(ROW(Data!$A$1:$M$437))+1),ROWS($1:1)),COLUMNS($A:A))),"")

    Regards
    Last edited by XOR LX; 09-06-2013 at 02:50 PM.
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Registered User
    Join Date
    08-28-2013
    Location
    Phoenix, Arizona
    MS-Off Ver
    Excel 2010, 2013
    Posts
    69

    Re: Countifs In Array Not Working As Expected, then Update question

    Hello, XOR LX - Thanks for the quick reply.

    1 - The countifs assist with relative cell references in order to pull the next matching record from the source data (Data tab). A simple if statement does not assist with mathematical calculations by counting the number of rows that meet a specific criteria.
    2 - The small function returns the first row number, I believe, but the matching isn't working as expected anyway, I'm still getting records with "HR" in them and this is why the function isn't performing as expected.
    3 - Upper in the calculation is used for all columns due to text that I want returned in uppercase. I can remove the ones I don't need later - good catch though!
    4 - Row and column is not for row insertion, it is for retrieving matched data based on relative cell references based on the number of records counted in the countifs... which isn't working as expected.

    To see the formula working correctly, and as expected, view the Overview, SupShifts, Location and DynDrop tabs. It worked on four other tabs... just not this one with blanks or "" values.

    I'll test your example and see what happens though!

    Thanks!

    Jan

  4. #4
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Countifs In Array Not Working As Expected, then Update question

    "A simple if statement does not assist with mathematical calculations by counting the number of rows that meet a specific criteria"

    I wasn't suggesting you use it just on its own! Look at the formula I gave you and see how it's incorporated within the array.

    "The small function returns the first row number"

    Incorrect. The SMALL function returns the kth smallest number, depending on the value of k.

    "Row and column is not for row insertion"

    I didn't say that it was. I stated that the use of ROW() and COLUMN() in formulas will potentially give inaccurate results should extra rows or columns be inserted within your table. Although this might seem unlikely, I have half a suspicion that this is why your first formula is using ROW(A2) for the SMALL function (instead of ROW(A1)), which cannot be correct - perhaps you inserted an extra row at the top of your sheet after you had created these formulas?

    Regards

  5. #5
    Registered User
    Join Date
    08-28-2013
    Location
    Phoenix, Arizona
    MS-Off Ver
    Excel 2010, 2013
    Posts
    69

    Re: Countifs In Array Not Working As Expected, then Update question

    XOR LX, Thanks - that seemed to work. Now I want to sort out why and I'll try modifying the calculations in the other worksheets and see how that does as well.

  6. #6
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Countifs In Array Not Working As Expected, then Update question

    You're welcome. Best of luck with the rest.

  7. #7
    Registered User
    Join Date
    08-28-2013
    Location
    Phoenix, Arizona
    MS-Off Ver
    Excel 2010, 2013
    Posts
    69

    Re: Countifs In Array Not Working As Expected, then Update question

    I think the countifs were for multiple criteria, but I'll have to look into that futher. Some worksheets require multiple criteria...

+ 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] Countifs array results not as expected, can anyone see why?
    By jason.b75 in forum Excel General
    Replies: 6
    Last Post: 07-15-2012, 01:45 PM
  2. New pictures dont update as expected
    By col12345 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-02-2011, 04:12 PM
  3. UPDATE ISNUMBER and nested FINDs not working as expected
    By johnmerlino in forum Excel General
    Replies: 4
    Last Post: 11-10-2010, 02:13 AM
  4. [SOLVED] IF statement is not working as expected?
    By Aland2929 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-31-2009, 02:02 PM
  5. Question about working with range array
    By 39N 95W in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-18-2006, 07:55 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