+ Reply to Thread
Results 1 to 5 of 5

IF function with an array

  1. #1
    Registered User
    Join Date
    04-12-2019
    Location
    USA
    MS-Off Ver
    2016
    Posts
    3

    IF function with an array

    I have a worksheet that looks like this: file attached at end of post:

    worksheet screen shot.jpg

    here is the file itself:

    This is what the names are for my ranges

    range names.jpg

    A14 is a drop list of names that looks like this:

    Charles
    Amanda
    Becky
    Polly
    Sloan
    Anna
    Susie


    B14 is a drop list of names that looks like this:

    Fred
    Mike
    Lynn
    John
    James
    Polly


    F14 is the following array: {=IF(C5:C11=A14,COUNTIF(INDIRECT((CONCATENATE(A14,"_calls"))),"="&B14),0)}

    It returns the correct value only if A14 is Charles

    HOWEVER, if I choose Amanda from the drop list in A14 and leave B14 as Fred, it returns 0 when it should be 1.

    I would appreciate any help in getting this to work correctly.
    Thanks,
    Attached Files Attached Files
    Last edited by Parrot61; 04-12-2019 at 09:13 PM. Reason: attaching files

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: IF function with an array

    Welcome to the Forum Parrot61!

    Please explain what the "correct value" is--what do you want this formula to do?

    An image attachment has limited value. Please attach the Excel file. It's easier than taking a screenshot first and then attaching that. Having your file allows us to see and experiment with your data, layout, formulas, code, and possibly attach a file with a completed solution.

    The paper clip icon does not work for attachments. To attach a file, under the text box where you type your reply click the Go Advanced button. On the next screen scroll down and click on Manage Attachments, which will show a pop-up window to Select and Upload a file. Then close the window.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    04-12-2019
    Location
    USA
    MS-Off Ver
    2016
    Posts
    3

    Re: IF function with an array

    Jeff, Thank you for letting me know about images. This is my first post on this site.

    What I want to happen is this:
    The array in F14 should look at the value in A14 (Charles) and the value in B14 (Fred) and look at the range named Charles_calls (which is Sheet1!$D$5:$BC$5) and count the number of cells with the name Fred (2)

    It works great as long as A14 is Charles but if I select Amanda from the drop list in A14 and leave B14 as Fred I should get the result of 1 but it gives me 0.

    I hope this makes since.

    Polly

  4. #4
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: IF function with an array

    INDIRECT(...) itself drive to name in A14, so just:

    Please Login or Register  to view this content.
    By the way, I wonder how you control a long list name. Belown formula will solve with no userdefine name:

    Please Login or Register  to view this content.
    Last edited by bebo021999; 04-12-2019 at 10:50 PM.
    Quang PT

  5. #5
    Registered User
    Join Date
    04-12-2019
    Location
    USA
    MS-Off Ver
    2016
    Posts
    3

    Re: IF function with an array

    Thank you Bebo. The countif works great. I was making it too complicated.

+ 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] Why can't I assign an array variable to an array function in my subroutine?
    By redsab in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-16-2017, 10:33 PM
  2. Find max in array, return corresponding value in array, without max function
    By cshwkhelp in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-07-2017, 11:26 PM
  3. Array Function: Using an array function to calculate loan outstanding
    By akshaythakker in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 08-30-2016, 05:33 PM
  4. Replies: 3
    Last Post: 04-02-2016, 08:16 PM
  5. SEARCH function returns array if first argument is array--Huh?
    By 6StringJazzer in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-10-2012, 07:23 PM
  6. Using the ReDim array function in a multidimensional array in excel
    By Doruli in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-05-2012, 01:43 PM
  7. Read Range To Array, Then Pass Array To Function
    By ProbablyNotARealName in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-20-2010, 12:29 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