+ Reply to Thread
Results 1 to 8 of 8

HELP! Excel 2010 | Unexpected results using MIN IF Array Formula with COUNTIFS

  1. #1
    Registered User
    Join Date
    08-01-2016
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    4

    HELP! Excel 2010 | Unexpected results using MIN IF Array Formula with COUNTIFS

    Hi All,

    I've been trying to figure out this issue for a couple of days now to no avail. Therefore, I'm hoping someone can kindly shed some light on it. I've attached a sample spreadsheet.

    I have 2 worksheets - 'Summary' is a cover sheet listing a Package field and then a Required By and Required Until field. The 'Component List' worksheet lists the names of components associated with a Package containing a Required By and Required Until column. What I'm trying to do is workout the minimum date for all components as part of a package in column C on 'Summary' and the maximum date for all components as part of a package in column D on 'Summary'.

    As I'm using Excel 2010, I'm using MIN and IF in an Array Formula. The formula I've come up with for the Required By date in Summary (column C) is as follows:

    {=IF(COUNTIFS('Component List'!$B$5:$B$224,Summary!$B$5:$B$19,'Component List'!D$5:D$224,"<>"&"")>0,MAX(IF('Component List'!$B$5:$B$224=Summary!$B$5,'Component List'!D$5:D$224)),"TBC")}

    The logic behind is IF there are any blanks within column C on 'Component List' for the components in said package (Coulmn B) then set the cell value as "TBC". If there aren't any blank within column C on 'Component List' for the components in said package (Coulmn B) then set the cell value as the minimum date.

    As you can see from the spreadsheet, I've highlighted the cells that are bring back the unexpected value. Is it a case that I'm using the COUNTIFS within an Array Formula (the curly brackets)? Any help would be very much appreciated.

    Cheers,

    Al
    Last edited by beaverkeggs; 08-01-2016 at 06:32 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,731

    Re: HELP! Excel 2010 | Unexpected results using MIN IF Array Formula with COUNTIFS

    Do not use a link to a file-sharing site, please. Instead, attach a sample workbook here. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    08-01-2016
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: HELP! Excel 2010 | Unexpected results using MIN IF Array Formula with COUNTIFS

    Hi,

    Apologies - have remove dthe link in the initial post and have attached an example spreadsheet with cut down data. Note that I'v eput the desired outcome on the 'Summary' worksheet under 'Desired Outcome'.

    Thanks
    Attached Files Attached Files

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,731

    Re: HELP! Excel 2010 | Unexpected results using MIN IF Array Formula with COUNTIFS

    Thanks. Personally, I won't open macro-enabled workbooks - sorry. Hopefully someone else will help.

  5. #5
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: HELP! Excel 2010 | Unexpected results using MIN IF Array Formula with COUNTIFS

    Criteria in COUNTIFS should be a single cell, not a range. Because you are passing an array to the logical test of IF and giving it nothing to compare the array to, it is only evaluating the fist element of the array, not the element relative to the criteria in the row.

    Also making the row relative means you can drag it down without editing each formula.

    Array confirm this one in C5 and fill down, change MIN to MAX and do the same for D5.

    =IF(COUNTIFS('Component List'!$B$5:$B$80,Summary!$B5,'Component List'!C$5:C$80,"<>"&"")>0,MIN(IF('Component List'!$B$5:$B$80=Summary!$B5,'Component List'!C$5:C$80)),"TBC")

  6. #6
    Registered User
    Join Date
    08-01-2016
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: HELP! Excel 2010 | Unexpected results using MIN IF Array Formula with COUNTIFS

    Thanks Jason. That does the trick.

    Noticed a slight issue though - if you sort on any of the fields that changes the order, the 'Summary!$BX' reference is no longer valid as it's doesn't change to the newly ordered cell reference e.g. sort by Required By A-Z moves the order. You know of any way round that?

    Cheers,

    Al

  7. #7
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: HELP! Excel 2010 | Unexpected results using MIN IF Array Formula with COUNTIFS

    Change Summary!$Bx to $Bx and it will work.

    When Summary! is used in the formula, excel doesn't have the sense to recognise that it is the same sheet, so it messes up the order.

  8. #8
    Registered User
    Join Date
    08-01-2016
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: HELP! Excel 2010 | Unexpected results using MIN IF Array Formula with COUNTIFS

    Awesome - thanks Jason. Appreciate your help

+ 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] Complex ??Need to adjust formula giving unexpected results with trim & substitute
    By JEAN1972 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-15-2015, 03:48 AM
  2. [SOLVED] Formula produces unexpected results
    By furface00 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-04-2014, 02:17 PM
  3. [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
  4. Formula giving unexpected results
    By johnmerlino in forum Excel General
    Replies: 6
    Last Post: 12-01-2010, 01:20 AM
  5. unexpected results when copying a formula
    By plumcloth in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-29-2010, 12:35 PM
  6. Trig formula unexpected results.
    By troth in forum Excel General
    Replies: 6
    Last Post: 07-23-2010, 09:33 AM
  7. Unexpected Results Pasting from Excel to Word
    By knecht in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 04-15-2009, 11:32 PM

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