+ Reply to Thread
Results 1 to 9 of 9

Thread: IF month and year?

  1. #1
    Registered User
    Join Date
    10-05-2011
    Location
    Veenendaal, Nederland
    MS-Off Ver
    Excel 2010
    Posts
    14

    Thumbs up IF month and year?

    Thanks all!
    Last edited by worecx; 10-06-2011 at 07:52 AM.

  2. #2
    Forum Guru
    Join Date
    10-28-2008
    Location
    Not here anymore
    MS-Off Ver
    irrelevant
    Posts
    10,150

    Re: IF month and year?

    Hello,

    Assuming you want to do this with a formula copied down the column of dates, the following should do it. There are lots of different ways. This is just one of many.

    =IF(J21="";0;(IF(text(j21;"MM-YYYY")="10-2003";1;0))

    If you can post a spreadsheet, it will be easier to put in the formula. Your regional settings use the semicolon, mine use the comma. An Excel workbook would make this difference transparent and help concentrate on the formula and the data instead of the punctuation.

    cheers,

  3. #3
    Valued Forum Contributor quekbc's Avatar
    Join Date
    01-18-2010
    Location
    Sydney, Australia
    MS-Off Ver
    2003, 2007, 2010
    Posts
    263

    Re: IF month and year?

    Hi Worecx,

    What you need is to use the AND function and MONTH function.

    Similar to your YEAR you can do something like

    (=IF(J21="";0;(IF(AND(YEAR(J21)=2003;MONTH(J21)=10);1;0)))

  4. #4
    Registered User
    Join Date
    10-05-2011
    Location
    Veenendaal, Nederland
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: IF month and year?

    Wow, thanks teylyn and quekbc.

    That really helped me out and it works perfectly. Yesterday i was busy trying formulas for 4 hours and gave up.

    Thanks again! Problem solved

  5. #5
    Registered User
    Join Date
    10-05-2011
    Location
    Veenendaal, Nederland
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: IF month and year? [Another question 15:38]

    My Excelsheet is getting up to 190mb now. Is there a way to just count all cells which have for example "10-2003"?

    Thanks again!

  6. #6
    Forum Moderator arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    4,299

    Re: IF month and year? [Another question 15:38]

    In a different cell, just type in =countif(A:A,1). Since the formula from quekbc returns 1 or 0, your criteria in the countif function will be 1.

  7. #7
    Registered User
    Join Date
    10-05-2011
    Location
    Veenendaal, Nederland
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: IF month and year?

    I'm looking for a new formula which will count the cells which contain (for example) 10-2003

    The formula has to look in the 65.000 records where month 10 and year 2003 appears (for example)

    This result has to be put in 1 cell.

    Hopefully you understand what i mean.

  8. #8
    Forum Moderator arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    4,299

    Re: IF month and year?

    You mean to say, you don't want to use the If & IF(And( functions given above but want to directly use the count or countif to arrive at the count of "10-2003"?

  9. #9
    Forum Moderator arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    4,299

    Re: IF month and year?

    You can do so if you use this function first

    (=IF(J21="";0;(IF(AND(YEAR(J21)=2003;MONTH(J21)=10);1;0)))
    and then use the count in an independent cell. You can hide the column that contains the above formula if you do not want to display it.

+ 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.2.0