+ Reply to Thread
Results 1 to 4 of 4

array formula with multiple conditions

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    02-09-2004
    Posts
    154

    array formula with multiple conditions

    ok I have a named range called thisweekmon which returns me the date that was on monday of the current week

    =IF(TEXT(NOW(),"ddd")="Mon",TODAY(),IF(TEXT(NOW(),"ddd")="Tue",TODAY()-1,IF(TEXT(NOW(),"ddd")="Wed",TODAY()-2,IF(TEXT(NOW(),"ddd")="Thu",TODAY()-3,IF(TEXT(NOW(),"ddd")="Fri",TODAY()-4,IF(TEXT(NOW(),"ddd")="Sat",TODAY()-5,TODAY()-6))))))

    this seems to work fine.

    Now I have a spreadsheet with column M containing Open or Closed, and column J containing a list of dates.

    What I need is a formula which counts the number of dates in column J that are both Open in column M, and within the current week (hence my thisweekmon name)

    I have got as far as getting it to count the number of dates where column M is Open, but I cant get it to only do this for dates that are => thisweekmon AND =<thisweekmon+6 (i.e. within the current week).

    this is the array formula I have which does that

    =IF(COUNT(IF($M$13:$M$10000="Open",$J$13:$J$10000,""))<>0,COUNT(IF($M$13:$M$10000="Open",$J$13:$J$10000,"")),"No items")

    any ideas how to also get it to make the 2 additional checks to ensure its also within the current week (based on a mon-sun week) ? I tried adding an AND in there but it kept returning no results.

    thanks

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Take a look at Sumproduct

    http://www.xldynamic.com/source/xld.SUMPRODUCT.html

    something like

    =SUMPRODUCT(--($M$13:$M$10000="Open")*($I$13:$I$10000>=DATEVALUE("28/05/07"))*($J$13:$J$10000))

    posting a sample of your data would give you the correct answer

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Forum Contributor
    Join Date
    02-09-2004
    Posts
    154
    aha thanks

    I managed it with

    =SUMPRODUCT(--($M$13:$M$10000="Open")*($J$13:$J$10000>=thisweekmon)*($J$13:$J$10000<=thisweekmon+6))

    seems to be working nicely

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Glad it helped

    VBA Noob

+ 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