Microsoft® Excel® based database addin

 

+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Ann Scharpf Guest

    Default SUMIF() to add cells in non-contiguous ranges? (Excel 2003)

    I have a bunch of columns with dollar values. I want to add the sum of all
    the values for rows that meet a single condition. If possible, I'd like to
    create a named a range that includes all the non-contiguous dollar value
    columns and use a single SUMIF(). In my test, I named this range DOLLARS.

    The formula =SUM(DOLLARS) does work fine and adds up ALL the values.

    To test the SUMIF(), I set up a column (named range "decision") with yes/no
    values. I get a #VALUE error when I try the formula
    =SUMIF(decision,"=yes",dollars).

    I looked at some of the posts for array functions and I can't really tell if
    an array formula would fix this problem. Is this possible to do as a single
    function, or do I have to have something like this:

    =SUMIF(decision,"=yes",dollars1)+SUMIF(decision,"= yes",dollars2)...

    Thanks for your help.
    --
    Ann Scharpf

  2. #2
    T. Valko Guest

    Default Re: SUMIF() to add cells in non-contiguous ranges? (Excel 2003)

    >In my test, I named this range DOLLARS.

    What are the individual range addresses that make up DOLLARS?

    >I set up a column (named range "decision") with yes/no


    What is the range address that makes up DECISION?

    --
    Biff
    Microsoft Excel MVP


    "Ann Scharpf" <AnnScharpf@discussions.microsoft.com> wrote in message
    news:30B2910B-5948-49E9-BDE8-4AE107514FE6@microsoft.com...
    >I have a bunch of columns with dollar values. I want to add the sum of all
    > the values for rows that meet a single condition. If possible, I'd like
    > to
    > create a named a range that includes all the non-contiguous dollar value
    > columns and use a single SUMIF(). In my test, I named this range DOLLARS.
    >
    > The formula =SUM(DOLLARS) does work fine and adds up ALL the values.
    >
    > To test the SUMIF(), I set up a column (named range "decision") with
    > yes/no
    > values. I get a #VALUE error when I try the formula
    > =SUMIF(decision,"=yes",dollars).
    >
    > I looked at some of the posts for array functions and I can't really tell
    > if
    > an array formula would fix this problem. Is this possible to do as a
    > single
    > function, or do I have to have something like this:
    >
    > =SUMIF(decision,"=yes",dollars1)+SUMIF(decision,"= yes",dollars2)...
    >
    > Thanks for your help.
    > --
    > Ann Scharpf




  3. #3
    Ann Scharpf Guest

    Default Re: SUMIF() to add cells in non-contiguous ranges? (Excel 2003)

    Well, my dummy test and the real document are set up differently.

    Dummy test:

    Decision = D418
    Dollars = E4:E18, G4:G18, I4:I18

    Real document:

    Customer Funding Category:
    F:F

    Material Costs:
    I:I, M:M
    --
    Ann Scharpf


    "T. Valko" wrote:

    > >In my test, I named this range DOLLARS.

    >
    > What are the individual range addresses that make up DOLLARS?
    >
    > >I set up a column (named range "decision") with yes/no

    >
    > What is the range address that makes up DECISION?
    >
    > --
    > Biff
    > Microsoft Excel MVP
    >
    >
    > "Ann Scharpf" <AnnScharpf@discussions.microsoft.com> wrote in message
    > news:30B2910B-5948-49E9-BDE8-4AE107514FE6@microsoft.com...
    > >I have a bunch of columns with dollar values. I want to add the sum of all
    > > the values for rows that meet a single condition. If possible, I'd like
    > > to
    > > create a named a range that includes all the non-contiguous dollar value
    > > columns and use a single SUMIF(). In my test, I named this range DOLLARS.
    > >
    > > The formula =SUM(DOLLARS) does work fine and adds up ALL the values.
    > >
    > > To test the SUMIF(), I set up a column (named range "decision") with
    > > yes/no
    > > values. I get a #VALUE error when I try the formula
    > > =SUMIF(decision,"=yes",dollars).
    > >
    > > I looked at some of the posts for array functions and I can't really tell
    > > if
    > > an array formula would fix this problem. Is this possible to do as a
    > > single
    > > function, or do I have to have something like this:
    > >
    > > =SUMIF(decision,"=yes",dollars1)+SUMIF(decision,"= yes",dollars2)...
    > >
    > > Thanks for your help.
    > > --
    > > Ann Scharpf

    >
    >
    > .
    >


  4. #4
    Luke M Guest

    Default Re: SUMIF() to add cells in non-contiguous ranges? (Excel 2003)

    What I think Biff was asking about was what is the logic behind the
    non-contiguous cell choices?
    As an quick example, this takes the sum of every 4th row that has a
    corresponding text of "Add"

    =SUMPRODUCT(--(NOT(MOD(ROW(A1:A20),4))),--(B1:B20="add"),(A1:A20))

    Then you can get away from the use of named ranges.
    --
    Best Regards,

    Luke M
    "Ann Scharpf" <AnnScharpf@discussions.microsoft.com> wrote in message
    newsF7B0F66-AF58-4833-8A10-9313AD015A27@microsoft.com...
    > Well, my dummy test and the real document are set up differently.
    >
    > Dummy test:
    >
    > Decision = D418
    > Dollars = E4:E18, G4:G18, I4:I18
    >
    > Real document:
    >
    > Customer Funding Category:
    > F:F
    >
    > Material Costs:
    > I:I, M:M
    > --
    > Ann Scharpf
    >
    >
    > "T. Valko" wrote:
    >
    >> >In my test, I named this range DOLLARS.

    >>
    >> What are the individual range addresses that make up DOLLARS?
    >>
    >> >I set up a column (named range "decision") with yes/no

    >>
    >> What is the range address that makes up DECISION?
    >>
    >> --
    >> Biff
    >> Microsoft Excel MVP
    >>
    >>
    >> "Ann Scharpf" <AnnScharpf@discussions.microsoft.com> wrote in message
    >> news:30B2910B-5948-49E9-BDE8-4AE107514FE6@microsoft.com...
    >> >I have a bunch of columns with dollar values. I want to add the sum of
    >> >all
    >> > the values for rows that meet a single condition. If possible, I'd
    >> > like
    >> > to
    >> > create a named a range that includes all the non-contiguous dollar
    >> > value
    >> > columns and use a single SUMIF(). In my test, I named this range
    >> > DOLLARS.
    >> >
    >> > The formula =SUM(DOLLARS) does work fine and adds up ALL the values.
    >> >
    >> > To test the SUMIF(), I set up a column (named range "decision") with
    >> > yes/no
    >> > values. I get a #VALUE error when I try the formula
    >> > =SUMIF(decision,"=yes",dollars).
    >> >
    >> > I looked at some of the posts for array functions and I can't really
    >> > tell
    >> > if
    >> > an array formula would fix this problem. Is this possible to do as a
    >> > single
    >> > function, or do I have to have something like this:
    >> >
    >> > =SUMIF(decision,"=yes",dollars1)+SUMIF(decision,"= yes",dollars2)...
    >> >
    >> > Thanks for your help.
    >> > --
    >> > Ann Scharpf

    >>
    >>
    >> .
    >>




  5. #5
    T. Valko Guest

    Default Re: SUMIF() to add cells in non-contiguous ranges? (Excel 2003)

    Well, the non-contiguous range DOLLARS presents a problem.

    Just because a range has a defined name doesn't mean you *have* to use that
    name!

    Here's how I would do it...

    =SUMPRODUCT(--(Decision="yes"),E4:E18+G4:G18+I4:I18)

    --
    Biff
    Microsoft Excel MVP


    "Ann Scharpf" <AnnScharpf@discussions.microsoft.com> wrote in message
    newsF7B0F66-AF58-4833-8A10-9313AD015A27@microsoft.com...
    > Well, my dummy test and the real document are set up differently.
    >
    > Dummy test:
    >
    > Decision = D418
    > Dollars = E4:E18, G4:G18, I4:I18
    >
    > Real document:
    >
    > Customer Funding Category:
    > F:F
    >
    > Material Costs:
    > I:I, M:M
    > --
    > Ann Scharpf
    >
    >
    > "T. Valko" wrote:
    >
    >> >In my test, I named this range DOLLARS.

    >>
    >> What are the individual range addresses that make up DOLLARS?
    >>
    >> >I set up a column (named range "decision") with yes/no

    >>
    >> What is the range address that makes up DECISION?
    >>
    >> --
    >> Biff
    >> Microsoft Excel MVP
    >>
    >>
    >> "Ann Scharpf" <AnnScharpf@discussions.microsoft.com> wrote in message
    >> news:30B2910B-5948-49E9-BDE8-4AE107514FE6@microsoft.com...
    >> >I have a bunch of columns with dollar values. I want to add the sum of
    >> >all
    >> > the values for rows that meet a single condition. If possible, I'd
    >> > like
    >> > to
    >> > create a named a range that includes all the non-contiguous dollar
    >> > value
    >> > columns and use a single SUMIF(). In my test, I named this range
    >> > DOLLARS.
    >> >
    >> > The formula =SUM(DOLLARS) does work fine and adds up ALL the values.
    >> >
    >> > To test the SUMIF(), I set up a column (named range "decision") with
    >> > yes/no
    >> > values. I get a #VALUE error when I try the formula
    >> > =SUMIF(decision,"=yes",dollars).
    >> >
    >> > I looked at some of the posts for array functions and I can't really
    >> > tell
    >> > if
    >> > an array formula would fix this problem. Is this possible to do as a
    >> > single
    >> > function, or do I have to have something like this:
    >> >
    >> > =SUMIF(decision,"=yes",dollars1)+SUMIF(decision,"= yes",dollars2)...
    >> >
    >> > Thanks for your help.
    >> > --
    >> > Ann Scharpf

    >>
    >>
    >> .
    >>




Similar Threads

  1. Limitation on Excel 2003 Non-Contiguous Cells?
    By Raeldor in forum Programming - VBA for Office (Not Excel Specific)
    Replies: 5
    Last Post: 08-05-2009, 11:37 AM
  2. Limitation on Excel 2003 Non-Contiguous Cells?
    By Raeldor in forum Programming - VBA for Office (Not Excel Specific)
    Replies: 5
    Last Post: 08-05-2009, 11:34 AM
  3. SUMIF formula with non contiguous cells
    By Billy B in forum Worksheet Functions
    Replies: 2
    Last Post: 04-17-2009, 06:06 PM
  4. Add non-contiguous cells to range?
    By Ed in forum Programming (VBA, VB, C# etc)
    Replies: 2
    Last Post: 03-01-2009, 05:17 PM
  5. Dynamic Ranges using non-contiguous cells and dependent on a cell value
    By Carlo Paoloni in forum Worksheet Functions
    Replies: 2
    Last Post: 02-11-2009, 05:46 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