+ Reply to Thread
Results 1 to 13 of 13

Thread: Array Formula: anyone can help me?

  1. #1
    Registered User
    Join Date
    12-12-2009
    Location
    Italy
    MS-Off Ver
    Excel 2003
    Posts
    15

    Exclamation Array Formula: anyone can help me?

    Hi,

    This is the first time I place a comment in a forum. I have a big problem with an array formula, anyone can help me?
    Attached is the file with the question.

    Thanks!
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor JeanRage's Avatar
    Join Date
    03-02-2009
    Location
    Nice, France
    MS-Off Ver
    Excel 2003
    Posts
    705

    Re: Excel Array Formula

    Hi,

    See attached sample ...

    HTH
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    12-12-2009
    Location
    Italy
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Excel Array Formula - Help!

    Thanks Jean,

    The gender must be "lookup" from the first tab, I see you added 1 and 2 values in the column A. For example, "M" users can be the # 1,3,5,etc....the same with "F" users...

    Sergio.

  4. #4
    Valued Forum Contributor JeanRage's Avatar
    Join Date
    03-02-2009
    Location
    Nice, France
    MS-Off Ver
    Excel 2003
    Posts
    705

    Re: Excel Array Formula - Help!

    Hi Sergio,

    Is the Users Tab complete or not ... ? you mention, 1,3,5, etc ... for M and may be 2,4,6, etc ... for F ...

  5. #5
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,223

    Re: Excel Array Formula - Help!

    Edited down.
    Last edited by JBeaucaire; 12-12-2009 at 09:33 AM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  6. #6
    Registered User
    Join Date
    12-12-2009
    Location
    Italy
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Excel Array Formula - Help!

    yes, the users tab is only with some samples, but I will paste about 5,000 records (users).
    So, in the formula there should be something like (initiatives!$D$2:$D$8= 'M or F' (Lookup from Users tab)....

  7. #7
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,223

    Re: Excel Array Formula - Help!

    Put this in C6 and then copy down:

    =SUMPRODUCT(--(initiatives!$B$2:$B$8=$C$4),--(initiatives!$C$2:$C$8=$C$5),--(LOOKUP(initiatives!$D$2:$D$8,users!$A$2:$A$4,users!$B$2:$B$4)=B6))

    Adjust the ranges to suit.

    When you expand the USER list, be sure the first column stays sorted ascending like it is now.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  8. #8
    Registered User
    Join Date
    12-12-2009
    Location
    Italy
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Excel Array Formula - Help!

    Quote Originally Posted by JBeaucaire View Post
    Put this in C6 and then copy down:

    =SUMPRODUCT(--(initiatives!$B$2:$B$8=$C$4),--(initiatives!$C$2:$C$8=$C$5),--(LOOKUP(initiatives!$D$2:$D$8,users!$A$2:$A$4,users!$B$2:$B$4)=B6))

    Adjust the ranges to suit.

    When you expand the USER list, be sure the first column stays sorted ascending like it is now.
    Thanks for your reply JBeaucaire, I really don't understand why Users must be sorted...I try to unsort them and the the formula give a wrong result...

  9. #9
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,223

    Re: Excel Array Formula - Help!

    Quote Originally Posted by sivanvega View Post
    Thanks for your reply JBeaucaire, I really don't understand why Users must be sorted...I try to unsort them and the the formula give a wrong result...
    The LOOKUP function requires that the column A be sorted ascending. That's an Excel thing and it's not problematic. Keeping the list in order of 1,2,3, etc is common practice and easy to read.

    My suggestion is to use that formula and keep the User list sorted by column A.

    ============
    If there's some good reason to jumble the values on the user's list, then this alternate version will work:

    =SUMPRODUCT((initiatives!$B$2:$B$8=$C$4)*(initiatives!$C$2:$C$8=$C$5)*(VLOOKUP(initiatives!$D$2:$D$8 ,users!$A$2:$B$4,2,FALSE)=B6))

    ...but I wouldn't jumble the values.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  10. #10
    Registered User
    Join Date
    12-12-2009
    Location
    Italy
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Excel Array Formula - Help!

    Quote Originally Posted by JBeaucaire View Post
    The LOOKUP function requires that the column A be sorted ascending. That's an Excel thing and it's not problematic. Keeping the list in order of 1,2,3, etc is common practice and easy to read.

    My suggestion is to use that formula and keep the User list sorted by column A.

    ============
    If there's some good reason to jumble the values on the user's list, then this alternate version will work:

    =SUMPRODUCT((initiatives!$B$2:$B$8=$C$4)*(initiatives!$C$2:$C$8=$C$5)*(VLOOKUP(initiatives!$D$2:$D$8 ,users!$A$2:$B$4,2,FALSE)=B6))

    ...but I wouldn't jumble the values.
    Thanks....with VLOOKUP seems not working good.....look the attached sample...the result must be M=1 and F=1.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    12-12-2009
    Location
    Italy
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Excel Array Formula - Help!

    Many and many thanks to all!

  12. #12
    Forum Moderator daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2007
    Posts
    10,055

    Re: Excel Array Formula - Help!

    Quote Originally Posted by JBeaucaire View Post
    =SUMPRODUCT((initiatives!$B$2:$B$8=$C$4)*(initiatives!$C$2:$C$8=$C$5)*(VLOOKUP(initiatives!$D$2:$D$8 ,users!$A$2:$B$4,2,FALSE)=B6))
    This won't work because VLOOKUP, unlike LOOKUP, can't return an array when fed an array as the lookup value.

    If you don't have Users!A2:A4 sorted ascending then you could use this array formula

    =SUM((initiatives!B$2:B$8=$C$4)*(initiatives!C$2:C$8=$C$5)*(initiatives!D$2:D$8<>"")*ISNUMBER(MATCH( initiatives!D$2:D$8,IF(users!B$2:B$4=B6,users!A$2:A$4,""),0)))

    confirmed with CTRL+SHIFT+ENTER

  13. #13
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,423

    re: Array Formula: anyone can help me?

    And just to add the obvious - if you could calculate gender per transaction on initiatives sheet (via VLOOKUP) you could then revert to the more efficient COUNTIFS function and/or better yet use a Pivot Table to analyse the data ...
    either/or would IMO prove beneficial long term (as I say, if viable).

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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.2.0