+ Reply to Thread
Results 1 to 11 of 11

Help!! Using 2 date fields to determine Month - Multiple "ifs & Ands"..........

  1. #1
    Registered User
    Join Date
    11-06-2015
    Location
    Oklahoma City, OK
    MS-Off Ver
    Excel 2007
    Posts
    6

    Angry Help!! Using 2 date fields to determine Month - Multiple "ifs & Ands"..........

    I have been trying since yesterday to come up with the correct formula for identifying the correct month using 2 date fields. The formula appears right but it doesn't work.

    Below is the formula I'm using but it just shows Jan & Feb. I eventually want to use it in determining all the months and quarters. Can anyone help?? Below is the Formula.

    =IF(AND(B6=DATEVALUE("1/1/15"),D6=DATEVALUE("1/31/15")),"January",IF(AND(B6=DATEVALUE("02/01/15"),D6=DATEVALUE("02/29/15")),"February","Special Report Period"))
    Last edited by Sny21; 11-06-2015 at 05:21 PM. Reason: Solved!!

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Help!! Using 2 date fields to determine Month - Multiple "ifs & Ands"..........

    Are you trying to identify the month in a given cell? It's unclear what your formula is trying to do.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Help!! Using 2 date fields to determine Month - Multiple "ifs & Ands"..........

    Welcome to the forum.

    If you want to check for all 12 months, a long IF statement almost certainly isn't the best way to do it - even worse if you eventually want to identify quarters as well. As ChemistB says, let us know what it is you're actually trying to do and we should be able to come with a way of doing it. The easiest way to do this is normally to post a sample file showing the data you have and the results you want (make sure you don't include any confidential information). To attach a file, click 'Go Advanced' under the reply box and then use the paperclip icon.
    Regards,
    Aardigspook

    I recently started a new job so am a bit busy and may not reply quickly. Sorry - it's not personal - I will reply eventually.
    If your problem is solved, please go to 'Thread Tools' above your first post and 'Mark this Thread as Solved'.
    If you use commas as your decimal separator (1,23 instead of 1.23) then please replace commas with semi-colons in your formulae.
    You don't need to give me rep if I helped, but a thank-you is nice.

  4. #4
    Registered User
    Join Date
    11-06-2015
    Location
    Oklahoma City, OK
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Help!! Using 2 date fields to determine Month - Multiple "ifs & Ands"..........

    The spreadsheet pulls data from a period of time to produce a report using only the date range identified by cells B6 and D6. What I'm trying to also is create a cover page for the report so when printed, the report will have a cover page showing the month or Qtr the period is for. IF not one of those standard dates, it will just reflect "Special Report Period".

    I hope this helps. I kind of figured there was an easier way to do it but it is beyond my skill level. Always learning...
    Attached Files Attached Files
    Last edited by Sny21; 11-06-2015 at 04:25 PM.

  5. #5
    Registered User
    Join Date
    11-06-2015
    Location
    Oklahoma City, OK
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Help!! Using 2 date fields to determine Month - Multiple "ifs & Ands"..........

    I've uploaded the spreadsheet. Thanks for taking a look at it.

  6. #6
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Help!! Using 2 date fields to determine Month - Multiple "ifs & Ands"..........

    Okay, so the extent of the report is given by B6 and D6 (first and last date)?
    Maybe something like this?

    =IF(MONTH(B6)=MONTH(D6), TEXT(B6, "mmmm"), LOOKUP(MONTH(B6), {1,4,7,10}, {"1st Quarter", "2nd Quarter", "3rd Quarter", "4th Quarter")

  7. #7
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Help!! Using 2 date fields to determine Month - Multiple "ifs & Ands"..........

    Having said that a multiple IF might not be the best solution I think this will do what you want:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    The formula first checks that D6 is after B6 - if not, you get an error message saying the end date has to be after the start date.
    Then it checks for a monthly report (B6 = 1st of month and D6 is the last day of the same month).
    Then it checks for each quarter (B6 = 1st of month and D6 = end of third month after that and the B6 month = 1/4/7/10).
    The quarterly checks assume that Q1 = Jan-Mar, Q2 = Apr-Jun, etc. If your Q's are different, amend the months appropriately.

    Hope that does what you want.

    Edit: amended to put 'TEXT(B6,"mmmm")' instead of just 'B6' for the monthly report.
    Last edited by Aardigspook; 11-06-2015 at 04:42 PM. Reason: Format result as long month

  8. #8
    Registered User
    Join Date
    11-06-2015
    Location
    Oklahoma City, OK
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Help!! Using 2 date fields to determine Month - Multiple "ifs & Ands"..........

    That's incredible.. Your way beyond my skill level!! I plugged in the formula and changed the cell format. The months and quarters pop. I do have a question... The date displays 1-Jan for January and 1-Feb for February. Can it be modified to show 2-Feb, 3-Mar, etc..?

  9. #9
    Registered User
    Join Date
    11-06-2015
    Location
    Oklahoma City, OK
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Help!! Using 2 date fields to determine Month - Multiple "ifs & Ands"..........

    That fixed it!! Now I'm going to study the formula and hopefully understand how it's working. I really appreciate the help!! Have a great weekend!! Thanks!!

  10. #10
    Registered User
    Join Date
    11-06-2015
    Location
    Oklahoma City, OK
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Help!! Using 2 date fields to determine Month - Multiple "ifs & Ands"..........

    Thanks for your review and help!

  11. #11
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Help!! Using 2 date fields to determine Month - Multiple "ifs & Ands"..........

    You're welcome, and thanks for the rep and the kind comments with it.

+ 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. templates can't be applied to PivotCharts with multiple "axis (category)" fields
    By 58906341589615896 in forum Excel Charting & Pivots
    Replies: 7
    Last Post: 10-30-2014, 07:50 AM
  2. [SOLVED] CountIf Date Equals Specific "Month" Across Multiple Columns
    By molson1973 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-31-2014, 01:12 PM
  3. [SOLVED] Excel 2007: How to Convert "5/2/2013" to "May" then subtract a Month so it's "Apr"
    By Golom in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-19-2013, 02:00 AM
  4. Replies: 5
    Last Post: 06-14-2013, 05:21 AM
  5. Sorting by "Difference" results between two Date/Time fields
    By RitaB in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-05-2013, 03:19 PM
  6. Convert "Date" to week & month Month automatically
    By ajxxx in forum Excel General
    Replies: 7
    Last Post: 11-16-2008, 04:20 PM

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