+ Reply to Thread
Results 1 to 6 of 6

"If" statements for multiple dates and date ranges that correspond to different formulas

  1. #1
    Registered User
    Join Date
    07-01-2022
    Location
    New York, US
    MS-Off Ver
    365
    Posts
    3

    "If" statements for multiple dates and date ranges that correspond to different formulas

    I have a bunch of "If And" statements, as I want to apply a certain formula depending on date range (it's a cost forecasting model by month - so, there would be a certain formula if it's before a certain date, if it's between certain dates, and after a certain date). The formula works fine until I try "book-end" it with a simple "if" statement at the beginning and at the end (e.g., if the date is less than x, then it's y calculation; if the date is more than B date, then use C calc). When I add that logic in, I get a "#VALUE" message.

    Below is the formula itself, and I have attached the spreadsheet for reference. Any help would be greatly appreciated!!

    =IF(AND(S$30>=$D$30,S$30<$E$30),$M$32*$D32,IF(AND(S$30>=$E$30,S$30<$F$30),$M$32*$E32,IF(AND(S$30>=$F$30,S$30<$G$30),$M$32*$F32,IF(AND(S$30>=$G$30,S$30<$H$30),$M$32*$G32)*0)))
    Attached Files Attached Files

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.92 (24120731))
    Posts
    9,100

    Re: "If" statements for multiple dates and date ranges that correspond to different formul

    =IF(AND(N$6>=$B$6,N$6<$C$6),$I$8*$B8,IF(AND(N$6>=$C$6,N$6<$D$6),$I$8*$C8,IF(AND(N$6>=$D$6,N$6<$E$6),$I$8*$D8,IF(AND(N$6>=$E$6,N$6<$F$6),$I$8*$E8)*0))),IF(N6>F6,I8*F8,0) in spreadsheet

    I breakdown into lines - in a notes document

    =IF(
    AND(N$6>=$B$6,N$6<$C$6),
    $I$8*$B8,
    IF(
    AND(N$6>=$C$6,N$6<$D$6),
    $I$8*$C8,
    IF(
    AND(N$6>=$D$6,N$6<$E$6),
    $I$8*$D8,
    IF(
    AND(N$6>=$E$6,N$6<$F$6),
    $I$8*$E8)*0

    ))),
    IF(N6>F6,I8*F8,0)


    So you have stopped the nested IF ???

    is this what you want
    =IF(AND(N$6>=$B$6,N$6<$C$6),$I$8*$B8,IF(AND(N$6>=$C$6,N$6<$D$6),$I$8*$C8,IF(AND(N$6>=$D$6,N$6<$E$6),$I$8*$D8,IF(AND(N$6>=$E$6,N$6<$F$6),$I$8*$E8*0,IF(N6>F6,I8*F8,0)))))

    BUT
    $I$8*$E8*0

    will be zero - is that what you wanted

    Just go back and cary on Nesting the IF's , and when finished add the final False and ))))))

    should it be

    =IF(AND(N$6>=$B$6,N$6<$C$6),$I$8*$B8,IF(AND(N$6>=$C$6,N$6<$D$6),$I$8*$C8,IF(AND(N$6>=$D$6,N$6<$E$6),$I$8*$D8,IF(AND(N$6>=$E$6,N$6<$F$6),$I$8*$E8,IF(N6>F6,I8*F8,0)))))
    Attached Files Attached Files
    Last edited by etaf; 07-01-2022 at 04:24 PM.
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Registered User
    Join Date
    07-01-2022
    Location
    New York, US
    MS-Off Ver
    365
    Posts
    3

    Re: "If" statements for multiple dates and date ranges that correspond to different formul

    Thank you so much, that works great!

    Quick other question -- if I wanted to pull the "Phase" inputs (columns B - F) from an assumptions sheet that had %s for various phases, employee types, and employee seniority levels all summarized, what formula would I use to pull them? I could link them manually, but feel like that's error-prone (e.g., pulling the % for Phase 1 for a director level employee etc. etc. )

  4. #4
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.92 (24120731))
    Posts
    9,100

    Re: "If" statements for multiple dates and date ranges that correspond to different formul

    sounds like a index/match or vlookup
    But it would be better to start a new thread and have a sample sheet again for that specific question, so its new for everyone to see

    you could always reply and add the link to the new post here , if you wanted

  5. #5
    Registered User
    Join Date
    07-01-2022
    Location
    New York, US
    MS-Off Ver
    365
    Posts
    3

    Re: "If" statements for multiple dates and date ranges that correspond to different formul

    That makes sense.

    I've reattached the file with an assumptions tab. I would be looking to populate the cells highlighted in yellow on the 2nd tab by pulling straight from the first based on a few criteria (employee title, date, and phase of project).

    It seems like it would be an index/match situation, but I keep getting errors when I try.
    Attached Files Attached Files

  6. #6
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.92 (24120731))
    Posts
    9,100

    Re: "If" statements for multiple dates and date ranges that correspond to different formul

    i think this is what you are after
    =INDEX(Assumptions!C$6:C$10,MATCH('Detail by Workstream'!$C32,Assumptions!$B$6:$B$10,0))

    But no explanation, so just guessing

    also i suggested stating a new question on the forum , rather than continue here with further replies for a different question

    so if thats not correct , and does not answer the question, please do not continue here, but start a new thread / question in a new thread
    Attached Files Attached Files

+ 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. Replies: 2
    Last Post: 04-24-2020, 02:41 AM
  2. Replies: 5
    Last Post: 02-05-2019, 12:03 AM
  3. [SOLVED] Need addtional criteria to count where "Actual" dates earlier that "Scheduled" DATE
    By Ochimus in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-22-2018, 07:54 PM
  4. Replies: 2
    Last Post: 07-24-2017, 02:19 AM
  5. Replies: 1
    Last Post: 01-22-2016, 09:21 AM
  6. Replies: 1
    Last Post: 01-15-2014, 08:53 AM
  7. Replies: 2
    Last Post: 08-19-2009, 02:11 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