+ Reply to Thread
Results 1 to 18 of 18

sumproduct formula only counting dates in column

Hybrid View

jyadayada sumproduct formula only... 08-09-2012, 07:58 AM
NBVC Re: sumproduct formula only... 08-09-2012, 08:07 AM
jyadayada Re: sumproduct formula only... 08-09-2012, 08:32 AM
Max, Singapore Re: sumproduct formula only... 08-09-2012, 09:29 AM
jyadayada Re: sumproduct formula only... 08-09-2012, 09:50 AM
Max, Singapore Re: sumproduct formula only... 08-09-2012, 10:00 AM
NBVC Re: sumproduct formula only... 08-09-2012, 08:38 AM
jyadayada Re: sumproduct formula only... 08-09-2012, 08:56 AM
jyadayada Re: sumproduct formula only... 08-09-2012, 09:16 AM
Jockney Re: sumproduct formula only... 08-09-2012, 08:45 AM
NBVC Re: sumproduct formula only... 08-09-2012, 09:20 AM
NBVC Re: sumproduct formula only... 08-09-2012, 10:01 AM
jyadayada Re: sumproduct formula only... 08-09-2012, 10:08 AM
NBVC Re: sumproduct formula only... 08-09-2012, 10:54 AM
jyadayada Re: sumproduct formula only... 08-09-2012, 11:29 AM
NBVC Re: sumproduct formula only... 08-09-2012, 12:31 PM
jyadayada Re: sumproduct formula only... 08-09-2012, 12:41 PM
Cutter Re: sumproduct formula only... 08-09-2012, 03:40 PM
  1. #1
    Forum Contributor
    Join Date
    02-16-2010
    Location
    Manchester, England
    MS-Off Ver
    Microsoft 365 for Enterprise
    Posts
    103

    sumproduct formula only counting dates in column

    I have column from a software export that contains dates, yet some of them are in a convoluted format, no matter what i do i can't unify the whole column into date format, so i'm now trying to do a near as count of occurrences in the column, say how many occurences in each month of each year,

    so i started with the formula

    =SUMPRODUCT(('Export 02-08-2012'!M:M>=A2)*('Export 02-08-2012'!M:M<=B2))

    and then tried

    =SUMPRODUCT(IFISDATE(('Export 02-08-2012'!M:M>=A1)*('Export 02-08-2012'!M:M<=B1)))

    the first bringing back the #VALUE! error, the second the #NAME? error

    any suggestions folks?

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: sumproduct formula only counting dates in column

    In Excel 2003, you can't use whole columns with SUMPRODUCT... and if column M contain dates, the first one should work.

    Can you post a sample workbook showing what you've got and what you are looking to accomplish?

    Also ISDATE is not a valid function.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Contributor
    Join Date
    02-16-2010
    Location
    Manchester, England
    MS-Off Ver
    Microsoft 365 for Enterprise
    Posts
    103

    Re: sumproduct formula only counting dates in column

    The formula =SUMPRODUCT(('Export 02-08-2012'!M:M>=A2)*('Export 02-08-2012'!M:M<=B2)) is taking into account that column a and column b contain the start date and end date for each month i'm trying to get a return against

    there are also blanks in the column, basically the column is about 82000 rows, and i just need as best count as possible of what dates in the column are count-able, ignoring non dates and blanks
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor
    Join Date
    09-07-2006
    Posts
    520

    Re: sumproduct formula only counting dates in column

    Think you could try something like this in E1, copied down:
    =SUMPRODUCT(--(TEXT(Export!M$2:M$100,"mmm yyyy")=TEXT(B1,"mmm yyyy")))
    where in B1 down are real dates, eg 1st of month dates such as 01 Jan 2001, 01 Feb 2001, etc

    TEXT is used here to extract the "month-year" from the data in col M in Export and from col B for the comparison
    Sumproduct then adds it up all the instances where the "month-year" comparison matches
    Last edited by Max, Singapore; 08-09-2012 at 09:35 AM.

  5. #5
    Forum Contributor
    Join Date
    02-16-2010
    Location
    Manchester, England
    MS-Off Ver
    Microsoft 365 for Enterprise
    Posts
    103

    Re: sumproduct formula only counting dates in column

    Quote Originally Posted by Max, Singapore View Post
    Think you could try something like this in E1, copied down:
    =SUMPRODUCT(--(TEXT(Export!M$2:M$100,"mmm yyyy")=TEXT(B1,"mmm yyyy")))
    where in B1 down are real dates, eg 1st of month dates such as 01 Jan 2001, 01 Feb 2001, etc

    TEXT is used here to extract the "month-year" from the data in col M in Export and from col B for the comparison
    Sumproduct then adds it up all the instances where the "month-year" comparison matches
    Thanks but still returning the #VALUE! error

    ---------- Post added at 02:50 PM ---------- Previous post was at 02:49 PM ----------

    Quote Originally Posted by NBVC View Post
    Here is your sheet returned with Text to Columns applied to column M.

    Notice that the dates in the first sheet are all in 2001.. whereas the dates in column M are 2011 and 2012...so you will get 0 results if you don't have matches because of the year...
    On re-running the text to columns has worked, alas the formula is still returning a #VALUE! error

  6. #6
    Valued Forum Contributor
    Join Date
    09-07-2006
    Posts
    520

    Re: sumproduct formula only counting dates in column

    > .. Thanks but still returning the #VALUE! error
    Formula should work fine, that just means your source data in Export's col M contains at least 1 instance of #VALUE!
    Use AutoFilter on col M to locate all of these cells with #VALUE!, clear them with the DELETE key
    Max
    Singapore

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: sumproduct formula only counting dates in column

    The dates in column M are currently text strings... to fix that, select column M and go to Data|Text to Columns, click Next twice and in 3rd window, select Date in the column data format section, then select MDY or DMY based on your regional setting.. then your formulas should show results... but you should use defined range instead of whole column M:M for efficiency.

  8. #8
    Forum Contributor
    Join Date
    02-16-2010
    Location
    Manchester, England
    MS-Off Ver
    Microsoft 365 for Enterprise
    Posts
    103

    Re: sumproduct formula only counting dates in column

    Thanks for the input but it returns the same #VALUE! error

    ---------- Post added at 01:56 PM ---------- Previous post was at 01:54 PM ----------

    I've done that and it doesn't convert into date format, not only does it not correct the mdy to dmy format, but the resulting output reading same as it did before can't then be changed into other date layout format, and as such the for,ula still errors

  9. #9
    Forum Contributor
    Join Date
    02-16-2010
    Location
    Manchester, England
    MS-Off Ver
    Microsoft 365 for Enterprise
    Posts
    103

    Re: sumproduct formula only counting dates in column

    Quote Originally Posted by NBVC View Post
    The dates in column M are currently text strings... to fix that, select column M and go to Data|Text to Columns, click Next twice and in 3rd window, select Date in the column data format section, then select MDY or DMY based on your regional setting.. then your formulas should show results... but you should use defined range instead of whole column M:M for efficiency.
    I've done that and it doesn't convert into date format, not only does it not correct the mdy to dmy format, but the resulting output reading same as it did before can't then be changed into other date layout format, and as such the formula still errors

  10. #10
    Registered User
    Join Date
    08-06-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: sumproduct formula only counting dates in column

    You need to put a sum value in.

    Example

    =SUMPRODUCT(('Export 02-08-2012'!M:M>=A2)*('Export 02-08-2012'!M:M<=B2)*('Export 02-08-2012'!M:M))

    Give this a try and let me know.

    I've not the greatest with Sumproduct so let me know how it works out

  11. #11
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: sumproduct formula only counting dates in column

    Here is your sheet returned with Text to Columns applied to column M.

    Notice that the dates in the first sheet are all in 2001.. whereas the dates in column M are 2011 and 2012...so you will get 0 results if you don't have matches because of the year...
    Attached Files Attached Files

  12. #12
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: sumproduct formula only counting dates in column

    So on the sheet I gave you you back you are getting #VALUE error? You shouldn't, unless you added something to the formula, or you have errors in column M...

  13. #13
    Forum Contributor
    Join Date
    02-16-2010
    Location
    Manchester, England
    MS-Off Ver
    Microsoft 365 for Enterprise
    Posts
    103

    Re: sumproduct formula only counting dates in column

    No, in my master s/sheet that hold 82000 records on one tab, and is in total a 42mb file, but the formula should run, the text to columns seems to have unified the date column in the export tab?.....

  14. #14
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: sumproduct formula only counting dates in column

    Can you attach that workbook with that column as is... remove all other impertinent columns

  15. #15
    Forum Contributor
    Join Date
    02-16-2010
    Location
    Manchester, England
    MS-Off Ver
    Microsoft 365 for Enterprise
    Posts
    103

    Re: sumproduct formula only counting dates in column

    Quote Originally Posted by NBVC View Post
    Can you attach that workbook with that column as is... remove all other impertinent columns
    here you go

    i should have put a column in with a sequential count so please don't sort or i won't be able to paste it back in

    thanks
    Attached Files Attached Files

  16. #16
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: sumproduct formula only counting dates in column

    You have a #VALUE! error in row 5116 and some other #REF errors too.

    ---------- Post added at 12:31 PM ---------- Previous post was at 12:27 PM ----------

    You can use:

    =SUM(IF(ISNUMBER(A2:A900000),IF(A2:A90000>=D2,IF(A2:A90000<=E2,1))))

    confirmed with CTRL+SHIFT+ENTER not just ENTER to ignore the errors... here I have start/end dates in D2 and E2

  17. #17
    Forum Contributor
    Join Date
    02-16-2010
    Location
    Manchester, England
    MS-Off Ver
    Microsoft 365 for Enterprise
    Posts
    103

    Re: sumproduct formula only counting dates in column

    that worked perfectly, thanks for all your help, much appreciated!

  18. #18
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: sumproduct formula only counting dates in column

    @ jyadayada

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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