+ Reply to Thread
Results 1 to 5 of 5

array formula

  1. #1
    Jonathan Cooper
    Guest

    array formula

    Can't figure out why this formula isn't working. Column A1:A30 contain
    dates, starting with 9/1/05 and incrementing by one day. Column B1:B30
    contain numbers. I want to look at column A, and if it's a Monday, then I
    want to sum the values in column B.

    ={SUMPRODUCT((WEEKDAY(A1:A30,2)=1*($B$1:$B$30)))}

    My only guess is that you can't use the WEEKDAY function as an array.
    However, when I look at that part of the formula in the formula editor, it
    looks like it is working.

  2. #2
    Forum Contributor
    Join Date
    03-12-2004
    Posts
    329
    =SUMPRODUCT(--(WEEKDAY(A1:A30,2)=1),B1:B30)

    Quote Originally Posted by Jonathan Cooper
    Can't figure out why this formula isn't working. Column A1:A30 contain
    dates, starting with 9/1/05 and incrementing by one day. Column B1:B30
    contain numbers. I want to look at column A, and if it's a Monday, then I
    want to sum the values in column B.

    ={SUMPRODUCT((WEEKDAY(A1:A30,2)=1*($B$1:$B$30)))}

    My only guess is that you can't use the WEEKDAY function as an array.
    However, when I look at that part of the formula in the formula editor, it
    looks like it is working.

  3. #3
    Eric
    Guest

    RE: array formula

    Jonathan,

    I think you just mixed up your brackets. Try:
    =SUMPRODUCT((WEEKDAY(A1:A30,2)=1)*($B$1:$B$30))

    This seems to work for me. By the way, you don't need to enter SUMPRODUCT
    as an array formula.

    Another approach to this would be to use a helper column. Insert a new
    column for column B. Set B1=WEEKDAY(A1) and copy down. Then you can use
    =SUMIF(A1:A30,2,C1:C30)

    Eric

    "Jonathan Cooper" wrote:

    > Can't figure out why this formula isn't working. Column A1:A30 contain
    > dates, starting with 9/1/05 and incrementing by one day. Column B1:B30
    > contain numbers. I want to look at column A, and if it's a Monday, then I
    > want to sum the values in column B.
    >
    > ={SUMPRODUCT((WEEKDAY(A1:A30,2)=1*($B$1:$B$30)))}
    >
    > My only guess is that you can't use the WEEKDAY function as an array.
    > However, when I look at that part of the formula in the formula editor, it
    > looks like it is working.


  4. #4
    Jonathan Cooper
    Guest

    RE: array formula

    Thanks. I knew is was something stupid, but it just wasn't jumping out at me.

    "Eric" wrote:

    > Jonathan,
    >
    > I think you just mixed up your brackets. Try:
    > =SUMPRODUCT((WEEKDAY(A1:A30,2)=1)*($B$1:$B$30))
    >
    > This seems to work for me. By the way, you don't need to enter SUMPRODUCT
    > as an array formula.
    >
    > Another approach to this would be to use a helper column. Insert a new
    > column for column B. Set B1=WEEKDAY(A1) and copy down. Then you can use
    > =SUMIF(A1:A30,2,C1:C30)
    >
    > Eric
    >
    > "Jonathan Cooper" wrote:
    >
    > > Can't figure out why this formula isn't working. Column A1:A30 contain
    > > dates, starting with 9/1/05 and incrementing by one day. Column B1:B30
    > > contain numbers. I want to look at column A, and if it's a Monday, then I
    > > want to sum the values in column B.
    > >
    > > ={SUMPRODUCT((WEEKDAY(A1:A30,2)=1*($B$1:$B$30)))}
    > >
    > > My only guess is that you can't use the WEEKDAY function as an array.
    > > However, when I look at that part of the formula in the formula editor, it
    > > looks like it is working.


  5. #5
    Jim May
    Guest

    Re: array formula

    =SUMPRODUCT(--(WEEKDAY(A1:A30,1)=2),B1:B30)


    worked for me;
    HTH
    "Morrigan" <Morrigan.1v1sef_1126195510.5207@excelforum-nospam.com> wrote in
    message news:Morrigan.1v1sef_1126195510.5207@excelforum-nospam.com...
    >
    > =SUMPRODUCT(--(WEEKDAY(A1:A30,2)=1),B1:B30)
    >
    > Jonathan Cooper Wrote:
    >> Can't figure out why this formula isn't working. Column A1:A30 contain
    >> dates, starting with 9/1/05 and incrementing by one day. Column
    >> B1:B30
    >> contain numbers. I want to look at column A, and if it's a Monday,
    >> then I
    >> want to sum the values in column B.
    >>
    >> ={SUMPRODUCT((WEEKDAY(A1:A30,2)=1*($B$1:$B$30)))}
    >>
    >> My only guess is that you can't use the WEEKDAY function as an array.
    >> However, when I look at that part of the formula in the formula editor,
    >> it
    >> looks like it is working.

    >
    >
    > --
    > Morrigan
    > ------------------------------------------------------------------------
    > Morrigan's Profile:
    > http://www.excelforum.com/member.php...fo&userid=7094
    > View this thread: http://www.excelforum.com/showthread...hreadid=465922
    >




+ 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