+ Reply to Thread
Results 1 to 12 of 12

SUM/INDEX/LEN with date

Hybrid View

  1. #1
    Registered User
    Join Date
    11-23-2013
    Location
    Washington DC
    MS-Off Ver
    Excel 2010
    Posts
    69

    SUM/INDEX/LEN with date

    Hello everyone,

    I'm using the following formula to extract a count of multiple values in a cell:

    =SUM(INDEX((LEN($A$1:$A$100)-LEN(SUBSTITUTE($A$1:$A$100,H2,"")))/LEN(H2),0,0))

    I need to add a portion to the formula that looks for a date range in E:E (which are formatted MM-DDD-YYYY), specifically month to month. I'm not sure if a date criterion should go at the end of the formula, or in it. I'm used to using COUNTIFS, which are simple by comparison. I'm still learning more complicated functions, so apologies for submitting a question that probably has an easy answer (that I haven't found yet).
    Last edited by jimbosi; 02-25-2014 at 04:53 PM. Reason: increased clarity.

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: SUM/INDEX/LEN with date

    Hi,

    Assuming your date is in I2:

    =SUMPRODUCT(($E$1:$E$100=I2)*(LEN($A$1:$A$100)-LEN(SUBSTITUTE($A$1:$A$100,H2,"")))/LEN(H2))

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Registered User
    Join Date
    11-23-2013
    Location
    Washington DC
    MS-Off Ver
    Excel 2010
    Posts
    69

    Re: SUM/INDEX/LEN with date

    Thank you for such a quick reply. To explain further, I have a date column in E:E. Records come in, and I use the formula I included to count instances of a string in A:A. Now I need to do that on a monthly basis, meaning between two dates (1-31 Jan, for instance), count each instance of a string in a cell. I envision it being something like DATE >=2014,1,1 & DATE <=2014,1,31. Of course, that's not correct, and I'm uncertain where it would go in relation to the rest of the formula. I have a feeling it's some permutation of what I have placed where you put ($E$1:$E$100=I2)-- I just don't know enough syntax. Thanks again for your help.

    As an aside, the rest of my sheets only have one value in a cell, so I use COUNTIFS. That's not really achievable here (and I can't really use wildcards).

  4. #4
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: SUM/INDEX/LEN with date

    In that case I think you'll really need to upload an actual workbook example, with your desired result clearly outlined. Obviously replace any confidential/sensitive information with dummy data if necessary.

    Regards

  5. #5
    Registered User
    Join Date
    11-23-2013
    Location
    Washington DC
    MS-Off Ver
    Excel 2010
    Posts
    69

    Re: SUM/INDEX/LEN with date

    A:A has the strings I want to count. B:B contains the dates. H:H are the reference strings I want to have counted, and I:I is where I'm placing the aforementioned formula. I want to divide those columns by date (Jan, Feb, and so on). Thanks again.

    ExcelForumHelp.xlsx

  6. #6
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: SUM/INDEX/LEN with date

    Thanks. In which cells are your desired results to go?

    Regards

  7. #7
    Registered User
    Join Date
    11-23-2013
    Location
    Washington DC
    MS-Off Ver
    Excel 2010
    Posts
    69

    Re: SUM/INDEX/LEN with date

    "Number of Cites" I:I, would be transformed into date columns; I:I=Jan, J:J=Feb, K:K=Mar and so on. Thanks.

  8. #8
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: SUM/INDEX/LEN with date

    Ok, then presuming you enter the appropriate (Excel) 3-letter abbreviations (Jan, Feb, Mar, etc.) for the months in I1, J1, K1, etc. this formula in I2 and then copied across and down:

    =SUMPRODUCT((TEXT($B$1:$B$100,"mmm")=I$1)*(LEN($A$1:$A$100)-LEN(SUBSTITUTE($A$1:$A$100,$H2,"")))/LEN($H2))

    Regards

  9. #9
    Registered User
    Join Date
    11-23-2013
    Location
    Washington DC
    MS-Off Ver
    Excel 2010
    Posts
    69

    Re: SUM/INDEX/LEN with date

    Excellent. Unfortunately, I get zeroes all the way down. I1 is entered as "Jan 2014" and it displays as "Jan-2014". I entered your formula on the sheet I provided. I must be doing something wrong, so I'm including the modified sheet. Thanks!
    Attached Files Attached Files

  10. #10
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: SUM/INDEX/LEN with date

    Ah. In your last spreadsheet you had just Jan, Feb, etc. (no years).

    Try:

    =SUMPRODUCT((DATE(YEAR($B$2:$B$100),MONTH($B$2:$B$100),1)=I$1)*(LEN($A$2:$A$100)-LEN(SUBSTITUTE($A$2:$A$100,$H2,"")))/LEN($H2))

    Regards

  11. #11
    Registered User
    Join Date
    11-23-2013
    Location
    Washington DC
    MS-Off Ver
    Excel 2010
    Posts
    69

    Re: SUM/INDEX/LEN with date

    Bam! Perfect! Thanks for all your help. Problem solved. Cheers.

  12. #12
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: SUM/INDEX/LEN with date

    No worries! Glad I could help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Index Match Based on One Date Criteria, Table Contains Beginning Date and End Date
    By jcox1953 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-09-2014, 02:41 PM
  2. [SOLVED] INDEX date that MATCH on date range, MATCH code(string)
    By Dahlia in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-23-2014, 03:33 AM
  3. [SOLVED] Row Index on a Date
    By kristy.brown in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-09-2013, 06:13 PM
  4. index or sumproduct for date
    By jw01 in forum Excel General
    Replies: 2
    Last Post: 11-30-2012, 03:01 AM
  5. [SOLVED] Index Match to date
    By jimtoyz in forum Excel General
    Replies: 4
    Last Post: 08-28-2012, 10:32 AM

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