+ Reply to Thread
Results 1 to 7 of 7

Problems with a Crazy Array

  1. #1
    Registered User
    Join Date
    10-24-2006
    Posts
    3

    Unhappy Problems with a Crazy Array

    I am trying to write an array formula that does the following:

    • Checks that the date in column C is less than or equal to a given date, if so - takes the count (or sum, since it's an array) and multiplies it by 6
    • If the date is not less than or equal to the specified date, it then checks that the date in column D is less than or equal to a given date, if so - takes the count (or sum, since it's an array) and multiplies it by 3
    • If the date is not less than or equal to the specified date, it then checks that the date in column B is less than or equal to a given date, if so - takes the count (or sum, since it's an array) and multiplies it by 1
    • And then sums the total point value

    All the while I need to ignore the blanks. I've tried variations of the following:

    =SUM(IF(AND($C$3:$C$11<>"",$C$3:$C$11<=B14)>0,6,IF(AND($D$3:$D$11<>"",$D$3:$D$11<=B14)>0,3,IF(AND($B$3:$B$11<>"",$B$3:$B$11<=B14)>0,1))))

    =SUM(IF($C$3:$C$11<=$B14,((COUNT(IF($C$3:$C$11<=$B14,6)))-(COUNT(IF($C$3:$C$11="",1)))),IF($D$3:$D$11<=$B14,((COUNT(IF($D$3:$D$11<=$B14,3)))-(COUNT(IF($D$3:$D$11="",1)))),IF($B$3:$B$11<=$B14,((COUNT(IF($B$3:$B$11<=$B14,1)))-(COUNT(IF($B$3:$B$11="",1))))))))

    It's not calculating correctly - I've summed this small example up manually and it's off.

    Any help on this would be much appreciated! And yes, I am using CSE properly.
    Last edited by gstarborn; 10-24-2006 at 11:23 AM.

  2. #2
    Forum Contributor
    Join Date
    07-13-2006
    Posts
    400
    Quote Originally Posted by gstarborn
    I am trying to write an array formula that does the following:

    • Checks that the date in column C is less than or equal to a given date, if so - takes the count (or sum, since it's an array) and multiplies it by 6
    • If the date is not less than or equal to the specified date, it then checks that the date in column D is less than or equal to a given date, if so - takes the count (or sum, since it's an array) and multiplies it by 3
    • If the date is not less than or equal to the specified date, it then checks that the date in column B is less than or equal to a given date, if so - takes the count (or sum, since it's an array) and multiplies it by 1
    • And then sums the total point value

    All the while I need to ignore the blanks. I've tried variations of the following:

    =SUM(IF(AND($C$3:$C$11<>"",$C$3:$C$11<=B14)>0,6,IF(AND($D$3:$D$11<>"",$D$3:$D$11<=B14)>0,3,IF(AND($B$3:$B$11<>"",$B$3:$B$11<=B14)>0,1))))

    =SUM(IF($C$3:$C$11<=$B14,((COUNT(IF($C$3:$C$11<=$B14,6)))-(COUNT(IF($C$3:$C$11="",1)))),IF($D$3:$D$11<=$B14,((COUNT(IF($D$3:$D$11<=$B14,3)))-(COUNT(IF($D$3:$D$11="",1)))),IF($B$3:$B$11<=$B14,((COUNT(IF($B$3:$B$11<=$B14,1)))-(COUNT(IF($B$3:$B$11="",1))))))))

    It's not calculating correctly - I've summed this small example up manually and it's off.

    Any help on this would be much appreciated! And yes, I am using CSE properly.
    =sumproduct(--($C$1:$C$100<=date1)*6+--($D$1:$D$100<=date2)*3+--($B$1:$B$100<=date3))

    that assumes you have 100 rows of data. modify as needed.
    ensure that the number of rows of data for each of the three sections is equal or the formula will error. and obviously replace date1,2,3 with real dates

  3. #3
    Registered User
    Join Date
    10-24-2006
    Posts
    3
    Close - but it's not ignoring the blanks!

  4. #4
    Forum Contributor
    Join Date
    07-13-2006
    Posts
    400
    Quote Originally Posted by gstarborn
    Close - but it's not ignoring the blanks!
    sorry didn't see that part!

    add a ---($C$1:$C$100="")*6
    and the equivalent for D and B

    not the prettiest, but probably the easiest from where we are

  5. #5
    Registered User
    Join Date
    10-24-2006
    Posts
    3
    Yep - did that. But it's not registering that if C has a value, dont check column D or B.

  6. #6
    Forum Contributor
    Join Date
    07-05-2006
    Location
    Canada
    MS-Off Ver
    2003, 2007
    Posts
    581
    Quote Originally Posted by gstarborn
    Yep - did that. But it's not registering that if C has a value, dont check column D or B.
    Try this one... sort of complicated. I think there must be something simpler, but this has one benefit, it should work. :-P (I hope. :-D)

    =SUM(IF(C3:C11="",IF(D3:D11="",IF(B3:B11="",0,IF(B3:B11<=$B$14,1,0)),IF(D3:D11<=$B$14,3,IF(B3:B11="",0,IF(B3:B11<=$B$14,1,0)))),IF(C3:C11<=$B$14,6,IF(D3:D11="",IF(B3:B11="",0,IF(B3:B11<=$B$14,1,0)),IF(D3:D11<=$B$14,3,IF(B3:B11="",0,IF(B3:B11<=$B$14,1,0)))))))

    Scott

  7. #7
    Forum Contributor
    Join Date
    07-13-2006
    Posts
    400
    Quote Originally Posted by Maistrye
    Try this one... sort of complicated. I think there must be something simpler, but this has one benefit, it should work. :-P (I hope. :-D)

    =SUM(IF(C3:C11="",IF(D3:D11="",IF(B3:B11="",0,IF(B3:B11<=$B$14,1,0)),IF(D3:D11<=$B$14,3,IF(B3:B11="",0,IF(B3:B11<=$B$14,1,0)))),IF(C3:C11<=$B$14,6,IF(D3:D11="",IF(B3:B11="",0,IF(B3:B11<=$B$14,1,0)),IF(D3:D11<=$B$14,3,IF(B3:B11="",0,IF(B3:B11<=$B$14,1,0)))))))

    Scott
    wow. that's ugly. jk

    thanks scott

+ 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