+ Reply to Thread
Results 1 to 4 of 4

How do I get the following formula to work when referencing a closed workbook?

  1. #1
    Registered User
    Join Date
    04-26-2015
    Location
    UK
    MS-Off Ver
    2013
    Posts
    2

    How do I get the following formula to work when referencing a closed workbook?

    Hello,

    =SUM(--(FREQUENCY(IF(($B$1:$B$10000=1),COUNTIF($A$1:$A$10000,"<"&$A$1:$A$10000),""),COUNTIF($A$1:$A$10000,"<"&$A$1:$A$10000))>0)) CTRL+SHIFT+ENTER
    The above code counts unique values in column A if a value of 1 is in column B. It correctly ignores blank values which is why I prefer this method to others I found on the internet. However it is my understanding that the CountIf function doesn't work when referencing closed workbooks. How would I get the code above to work when referencing a closed workbook?

    Thank You,
    HumbleAko

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How do I get the following formula to work when referencing a closed workbook?

    Try this...

    =SUM(IF(FREQUENCY(IF(B1:B20=1,IF(A1:A20<>"",MATCH(A1:A20,A1:A20,0))),ROW(A1:A20)-ROW(A1)+1),1))

    Array entered.

    Not only will the above syntax work on a closed file, it's also more efficient than using COUNTIF.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    04-26-2015
    Location
    UK
    MS-Off Ver
    2013
    Posts
    2

    Re: How do I get the following formula to work when referencing a closed workbook?

    Quote Originally Posted by Tony Valko View Post
    Try this...

    =SUM(IF(FREQUENCY(IF(B1:B20=1,IF(A1:A20<>"",MATCH(A1:A20,A1:A20,0))),ROW(A1:A20)-ROW(A1)+1),1))

    Array entered.

    Not only will the above syntax work on a closed file, it's also more efficient than using COUNTIF.
    Hi Tony Valko,

    It works perfectly. Thank you!

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How do I get the following formula to work when referencing a closed workbook?

    You're welcome. Thanks for the feedback!

+ 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. Replies: 8
    Last Post: 08-18-2018, 11:51 PM
  2. Sumifs used referencing a closed workbook
    By kgallo in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-20-2015, 06:57 PM
  3. [SOLVED] Trouble copying data from closed workbook into active workbook, referencing help
    By lepperga in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-20-2013, 01:48 PM
  4. [SOLVED] Referencing a closed workbook
    By RowanB in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-03-2012, 05:13 AM
  5. UDF referencing closed workbook not working
    By davegugg in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 05-25-2010, 09:17 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