+ Reply to Thread
Results 1 to 6 of 6

Unable to get Array Formula Using Sum Function to work

  1. #1
    Registered User
    Join Date
    11-21-2007
    Posts
    15

    Unable to get Array Formula Using Sum Function to work

    I am not able to get the sum function to pick off isolated data from the worksheet. I selects information from only one column instead of reading from two columns and combine the information. I will paste the formula that brought me the closest to the desired result.

    =SUM((B98:B106="Jan"),(C98:C106="North")*D98:D106)

    The result I get is 450 which is from three North results in the worksheet. My request is for the formula to return a combination of Jan & North Sales. The result is for three North without regard for Jan. Can anyone help on this?

    Month Region Sales
    Jan North 100
    Jan South 200
    Jan West 300
    Feb North 150
    Feb South 250
    Feb West 350
    Mar North 200
    Mar South 300
    Mar West 400

  2. #2
    Forum Contributor
    Join Date
    10-30-2007
    Location
    Norway
    MS-Off Ver
    MS Office 2007
    Posts
    345
    Try this formula (not an array formula)

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    11-21-2007
    Posts
    15
    It returns a zero value. It should return 100. Any other suggestions

  4. #4
    Forum Contributor
    Join Date
    11-11-2005
    Posts
    267
    If you want the formula to return all January and all North ignoring any interdependency, use the following Array formula (remember to commit Ctrl+Shift+Enter keys).

    =SUM(((A98:A106="Jan")*C98:C106)+(B98:B106="North")*C98:C106)-(((A98:A106)="Jan")*((B98:B106="North")*C98:C106))

    The above formula yields 950.

    If, on the other hand, you want only Sales that occurred in Jan but only in the North region, the answer is the 100 that you hinted. The following array formula gets you there.

    =SUM(((A98:A106="Jan")*(B98:B106="North")*C98:C106))

    Bjornar's Sumproduct formula should produce the same answer.
    Last edited by Myles; 11-22-2007 at 02:43 AM.
    HTH
    Myles

    ...constantly looking for the smoother pebble while the whole ocean of truth lies before me.

  5. #5
    Registered User
    Join Date
    03-16-2004
    Location
    UK
    MS-Off Ver
    2003
    Posts
    85
    What are the -- in the formula above and why does it not work without them?

    =SUMPRODUCT(--(B98:B106="Jan"),--(C98:C106="North"),D98:D106)
    Phil

  6. #6
    Forum Contributor
    Join Date
    10-30-2007
    Location
    Norway
    MS-Off Ver
    MS Office 2007
    Posts
    345
    A1:A4="Jan"

    results in an array of this type {TRUE;FALSE;FALSE;FALSE}

    To use this for calculation it has to be transformed to an array of numerical values this is archived with -- (double negative), minus and minus equals pluss. This could also be archived with multiplying the array by 1.

    The result is then:

    {1;0;0;0}

    Select your formula and use Tools -> Formula auditing -> Evaluate formula. Then you can se how it work step by step.

    Did you get my SUMPRODUCT formula to work as it should now ?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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