+ Reply to Thread
Results 1 to 23 of 23

Find dates with matching month and year on a row -> return value 2 columns to the right

  1. #1
    Registered User
    Join Date
    11-15-2012
    Location
    Romppa, Finland
    MS-Off Ver
    Excel 2010
    Posts
    25

    Question Find dates with matching month and year on a row -> return value 2 columns to the right

    Okay, the title probably sounds really confusing, but what I am trying to accomplish, is a formula, that would go through values (dates) on a row. When a date with same year and month is found, it would return the value two columns right. Note, that there might be several matching cells with same month/year, so it shouldn't stop on the first match found.

    So far, I've tried something like this:

    INDEX(A2:J2;1;MATCH(DATE(YEAR(A1);MONTH(A1);1)+2;A2:J2;0))

    Note, that I am using Finnish excel, so ';' might have to be replaced with ','..


    \1

    Please help!
    Attached Images Attached Images
    Last edited by Cumbo; 11-20-2012 at 02:45 AM.

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Find dates with matching month and year on a row -> return value 2 columns to the righ

    In the first screenshot A1 cell date is a text data entered with "." instead of "-". So enter a valid date in Cell A1 and try.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    11-15-2012
    Location
    Romppa, Finland
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Find dates with matching month and year on a row -> return value 2 columns to the righ

    Quote Originally Posted by :) Sixthsense :) View Post
    In the first screenshot A1 cell date is a text data entered with "." instead of "-". So enter a valid date in Cell A1 and try.
    What do you mean? In Finland, this is "valid" date form.

    EDIT:

    it works fine, when there is a date on the row with same month, year and day is "1", but I have yet to figure out how to return the value, if the day is anything else than "1".

    \1

    Note: "#PUUTTUU!" = "#NA!"
    Last edited by Cumbo; 11-15-2012 at 08:01 AM.

  4. #4
    Registered User
    Join Date
    11-15-2012
    Location
    Romppa, Finland
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Find dates with matching month and year on a row -> return value 2 columns to the righ

    Any help??

  5. #5
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Find dates with matching month and year on a row -> return value 2 columns to the righ

    Not able to fix it and will be helpful if you attach a sample workbook.

  6. #6
    Registered User
    Join Date
    11-15-2012
    Location
    Romppa, Finland
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Find dates with matching month and year on a row -> return value 2 columns to the righ

    Quote Originally Posted by :) Sixthsense :) View Post
    Not able to fix it and will be helpful if you attach a sample workbook.
    Here it is:

    Table.xlsx

  7. #7
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Find dates with matching month and year on a row -> return value 2 columns to the righ

    Thanks for the attachment file, please let us know the expected output and the method to arrive it.

  8. #8
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: Find dates with matching month and year on a row -> return value 2 columns to the righ

    Criteria: A1
    Define name range A2:J2 - data


    =IFERROR(INDEX(data,SMALL(IF(ISNUMBER(data),IF(YEAR(data)=YEAR($A$1),IF(MONTH(data)=MONTH($A$1),TRANSPOSE(ROW(INDIRECT("1:"&COLUMNS(data))))+2))),COLUMNS($A:A))),"")

    Ctrl+Shift+Enter, not just enter
    Copy across

  9. #9
    Forum Expert Kevin UK's Avatar
    Join Date
    12-07-2010
    Location
    Radstock, Somerset
    MS-Off Ver
    365
    Posts
    1,922

    Re: Find dates with matching month and year on a row -> return value 2 columns to the righ

    Hi Cumbo

    Not sure if i am on the right wave length. This will return the Euro value 2 cells to the right of the date in row 2 which corresponds to the date in A1, if no match is found then "No Match".
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    11-15-2012
    Location
    Romppa, Finland
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Find dates with matching month and year on a row -> return value 2 columns to the righ

    Quote Originally Posted by Teethless mama View Post
    Criteria: A1
    Define name range A2:J2 - data


    =IFERROR(INDEX(data,SMALL(IF(ISNUMBER(data),IF(YEAR(data)=YEAR($A$1),IF(MONTH(data)=MONTH($A$1),TRANSPOSE(ROW(INDIRECT("1:"&COLUMNS(data))))+2))),COLUMNS($A:A))),"")

    Ctrl+Shift+Enter, not just enter
    Copy across
    I tried this and I only got 100 €. The formula should return 300 €, as there are two dates with same month and year (December 2012) between B2:J2.
    Attached Files Attached Files

  11. #11
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Find dates with matching month and year on a row -> return value 2 columns to the righ

    In A2 cell
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    11-15-2012
    Location
    Romppa, Finland
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Find dates with matching month and year on a row -> return value 2 columns to the righ

    Quote Originally Posted by :) Sixthsense :) View Post
    In A2 cell
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    600 € with this formula, too..
    Attached Files Attached Files

  13. #13
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Find dates with matching month and year on a row -> return value 2 columns to the righ

    When I opened your file it was showing 600 €, I just placed the cursor in A2 cell and pressed F2 and enter Its shown the 300 € as result.
    Last edited by :) Sixthsense :); 11-19-2012 at 05:06 AM. Reason: Correction

  14. #14
    Registered User
    Join Date
    11-15-2012
    Location
    Romppa, Finland
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Find dates with matching month and year on a row -> return value 2 columns to the righ

    Quote Originally Posted by :) Sixthsense :) View Post
    When I opened your file it was showing 600 €, I just placed the cursor in A2 cell and pressed F2 and enter Its shown the 600 € as result.
    600 € is wrong.

    2.12.2012 100 €
    5.12.2012 200 €
    8.3.2013 300 €

    --> the two dates, that have are within the same month and year as the date in A1 are 2.12.2012 and 5.12.2012 and thus the results should be (100 € + 200 € =) 300 €.

  15. #15
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Find dates with matching month and year on a row -> return value 2 columns to the righ

    Oops.. typo error I got 300. Now i corrected in my previous post.

  16. #16
    Registered User
    Join Date
    11-14-2012
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2007
    Posts
    33

    Re: Find dates with matching month and year on a row -> return value 2 columns to the righ

    When a date with same year and month is found, it would return the value two columns right.
    What does ''return the value two column to the right" mean? Do you want to write a formula in one cell and get the desired value in some other cells if the conditions are satisfied? It is not possible to write a formula in one cell and get the value in another cell.
    If you require the output in the fashion which i had mentioned then the situation can either be handled using VBA or please change your data in the form of a table.

    Please let me know if my understanding is wrong.

  17. #17
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Find dates with matching month and year on a row -> return value 2 columns to the righ

    Refer the attached Screenshot for reference.
    Attached Images Attached Images

  18. #18
    Registered User
    Join Date
    11-15-2012
    Location
    Romppa, Finland
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Find dates with matching month and year on a row -> return value 2 columns to the righ

    Quote Originally Posted by Vinoth Kanna View Post
    What does ''return the value two column to the right" mean? Do you want to write a formula in one cell and get the desired value in some other cells if the conditions are satisfied? It is not possible to write a formula in one cell and get the value in another cell.
    If you require the output in the fashion which i had mentioned then the situation can either be handled using VBA or please change your data in the form of a table.

    Please let me know if my understanding is wrong.
    The idea is simply to add all cells together, whose date is within the same month and year as the specified cell (in my table, cell A1). The date of each €-value cell is "two columns two the left of them". I.e. for the first date in column B, the corresponding € value is in column D. The second date is in column E and corresponding € value in column G etc.

  19. #19
    Registered User
    Join Date
    11-14-2012
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2007
    Posts
    33

    Re: Find dates with matching month and year on a row -> return value 2 columns to the righ

    If that is the case then the formula given by Sixthsense should work.

  20. #20
    Registered User
    Join Date
    11-15-2012
    Location
    Romppa, Finland
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Find dates with matching month and year on a row -> return value 2 columns to the righ

    11307733.jpg

    Hmmm... Doesn't work for me.

  21. #21
    Registered User
    Join Date
    11-15-2012
    Location
    Romppa, Finland
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Find dates with matching month and year on a row -> return value 2 columns to the righ

    Quote Originally Posted by Cumbo View Post
    Attachment 194734

    Hmmm... Doesn't work for me.
    Works now, had to replace "MMYYYY" with the Finnish version. Thanks a lot!


    That was the good news and now for the other stuff:

    the case I was trying to solve is more complex. For the sake of simplicity, I made another table which simplified the problem I had. I though I would get it working with the formula above, but turns out I was wrong.

    In my actual table:
    #1 there are more columns, from where the values must be picked to the other table
    #2 the name in column B (sheet "Case") must correspond to that in column A, sheet "€"
    #3 the value in column C (sheet "Case") must be "x"


    What I am trying to accomplish:

    Add all values from columns "Type 1 €", "Type 2 €" and "Type 3 €" (sheet "Case") on sheet "€". As mentioned above, the values added must also fulfill #2 and #3.
    Attached Files Attached Files

  22. #22
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Find dates with matching month and year on a row -> return value 2 columns to the righ

    In B2 cell – Non Array Formula

    This formula is worked for me
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    The below one is for you in B2 cell

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Drag it down and right.

  23. #23
    Registered User
    Join Date
    11-15-2012
    Location
    Romppa, Finland
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Find dates with matching month and year on a row -> return value 2 columns to the righ

    Quote Originally Posted by :) Sixthsense :) View Post
    In B2 cell – Non Array Formula

    This formula is worked for me
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    The below one is for you in B2 cell

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Drag it down and right.
    Wow, it worked! Just had to remove one extra space inside the quote marks in the first sumproduct formula. Other than than, worked perfect. Thanks a lot!

    =SUMPRODUCT(--(Case!$C$2:$C$23="x")*--(Case!$B$2:$B$23=$A2)*--(TEXT(Case!$F$2:$BC$23,"KKVVVV")=TEXT(B$1,"KKVVVV")),Case!$J$2:$BG$23)+SUMPRODUCT(--(Case!$C$2:$C$23="x")*--(Case!$B$2:$B$23=$A2)*--(TEXT(Case!$F$2:$BC$23,"KKVVVV")=TEXT(B$1,"KKVVVV")),Case!$K$2:$BH$23)+SUMPRODUCT(--(Case!$C$2:$C$23="x")*--(Case!$B$2:$B$23=$A2)*--(TEXT(Case!$F$2:$BC$23,"KKVVVV")=TEXT(B$1,"KKVVVV")),Case!$L$2:$BI$23)

+ 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