+ Reply to Thread
Results 1 to 27 of 27

Help with a string of IF statements

  1. #1
    Registered User
    Join Date
    06-24-2019
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 Pro Plus 64-Bit
    Posts
    13

    Help with a string of IF statements

    Hi Guys, long story short it’s been a long time since I’ve had to use a string of IF statements (probably college). I’ve had an unsuccessful crack at the below but think I just need to brush up on my excel skills in general. In the mean time I would be really grateful if someone might be able to help.

    Essentially, what I want is for the below model to:

    $F$5/4 & IF(H2>$E$4, H4=0, "") - If current date (feeding from H2) is greater than the lease expiry date (E4) then the value of the subject cell(H4-AA4) must equal zero.

    $F$5/4 & IF(H2>$D$4, H4=0, "") - If current date (feeding from H2) is greater than the lease break date (D4) then the value of the subject cell(H4-AA4) must equal zero.

    $F$5/4 & IF(H2=0, "VOID", "") - If the subject cell equals 0 then display "VOID" if not then no effect.

    & IF(D4:G4="VOID", $F$5/4, "") If there are (# per G4's input) x "VOID" periods preceding the subject cell, then the subject cell should revert to $F$5/4 if not then no effect.

    I’m not sure if this is even possible, thanks in advance.


    Capture.PNG

  2. #2
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Re: Help with a string of IF statements

    Instead of screenshot, please attach a sample file. This way we know the format of the data and suggest formula.
    Also, enter some expected results manually.
    1. Click on the * Add Reputation if you think this helped you
    2. Mark your thread as SOLVED when question is resolved

    Modytrane

  3. #3
    Registered User
    Join Date
    06-24-2019
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 Pro Plus 64-Bit
    Posts
    13

    Re: Help with a string of IF statements

    Sample.xlsx

    Thanks and apologies I should have thought of that.

    The results I am seeking are for the time related cells to zero out once they pass their expiry or break date but also to display the word "VOID" when this is the case. Once there has been a consecutive number of "VOID" periods determined by the VOID cell I want the subject cell to revert back to the initial formula of the "Rent" amount divided by 4.

    I appreciate this is somewhat convoluted and if it's not possible I completely understand.

    Thanks

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Help with a string of IF statements

    You have some Circ Ref errors in your file. Because that looks pretty complex, I suggest you attempt to fix those 1st, before members take a crack at your question.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Re: Help with a string of IF statements

    You have this formula in V4 of "Stressed Case Cashflow" sheet.

    =$F$4/4 & IF(V2>$D$4, V4=0, "") & IF(V2>$E$4, V4=0, "") & IF(V4=0, W4:Z4="VOID") & IF(R4:U4="VOID", V4=T4, "")

    This has circular reference because you are referencing V4 in it's own formula.
    Also, in the IF statement after the condition is met you need to have two results [for True or False]. Instead you have comparison statements.

    Please fix these formulas or explain the logic you want to use and someone will suggest correct formula.

    Part of the formula in V4:
    IF(V2>$E$4, V4=0, "") could be fixed as IF(V2>$E$4,0,"")

  6. #6
    Registered User
    Join Date
    06-24-2019
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 Pro Plus 64-Bit
    Posts
    13
    Apologies for the confusion I only meant to attach one sheet not the whole book and the stressed case was not meant to be included. I have attached one sheet now and here's a better outline of where I'm at:


    Expected results:

    1. When the current date (H2:AA2) exceeds either the "Lease Break" date (column D) or "Lease Expiry" (Column E) I want the rental values to drop off (or expire as it were).

    2. If the rental values have dropped off and the cell = 0 i want it to display the word "Void" for the amount of quarters specified in column G.

    3. Finally, I want the cashlows/rent to kick back in (at the level it was previously) after the specified amount of "Void" periods (per Column G) have elapsed.


    So I have tried to tackle each of these one at a time as follows:

    1. IF(H2>$E$4, 0, $F$4/4) & IF(H2>$D$4, 0, $F$4/4)

    2. & IF(H4=0, "VOID", "")

    3. IF(D4:G4="VOID", $F$5/4, "")


    Just to note the model takes the annual rental sum and divides it into quarterly amounts.


    I have attempted each element of the above separately in rows 4-7:

    1. Rows 4 & 5: when the current date exceeds the lease break date or lease expiry date I want the cell to revert to 0, I have these working separately.

    2. Row 6: I can get this working to an extent but I don't know if it is the delimiting or what but the text keeps disappearing (even though I've delimited cells).

    3. Row 7: This appears to be working okay.

    So I have tried (and failed) to merge all of these rules together and it's just not happening for me, any advice would be greatly appreciated.
    Attached Files Attached Files

  7. #7
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,543

    Re: Help with a string of IF statements

    Hello Conorg and Welcome to Excel Forum.
    Try pasting the following formula into cell H4 then drag the fill handle over to AA4, and while H4:AA4 are still selected drag the fill handle down to AA7: =IF(AND(H$2>$E4,H$2<=EOMONTH($E4,$G4*3)),"Void", $F4/4 )
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  8. #8
    Registered User
    Join Date
    06-24-2019
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 Pro Plus 64-Bit
    Posts
    13

    Re: Help with a string of IF statements

    This worked perfectly, thank you very much, really appreciate it!

  9. #9
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,543

    Re: Help with a string of IF statements

    You're Welcome and thank you for the feedback. Please take a moment to mark the thread as 'Solved' using the thread tools menu above your first post. I hope that you have a blessed day.

  10. #10
    Registered User
    Join Date
    06-24-2019
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 Pro Plus 64-Bit
    Posts
    13

    Re: Help with a string of IF statements

    Thanks again, apologies, I will mark as solved now! Just one more question if you don't mind, at present the formula displays "Void" if the date in row E is exceeded, is it possible to amend so that it will display "Void" if Row E or Row D are exceeded?

  11. #11
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,543

    Re: Help with a string of IF statements

    I am not positive that I understand however try modifying the formula to read: =IF(AND(OR(H$2>$E4,H$2>$D4),OR(H$2<=EOMONTH($E4,$G4*3),H$2<=EOMONTH($D4,$G4*3))),"Void", $F4/4 )
    If that doesn't do what you want, then upload the file with the expected results manually mocked up, so that we can attempt to replicate them.
    Let us know if you have any questions.

  12. #12
    Registered User
    Join Date
    06-24-2019
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 Pro Plus 64-Bit
    Posts
    13

    Re: Help with a string of IF statements

    Sorry to re-open this but there are things I would like to amend on this:


    Current Formula:

    =IF(AND(OR(K$2>$F4,K$2>$E4),OR(K$2<=EOMONTH($F4,$J4*3),K$2<=EOMONTH($E4,$J4*3))),"Void", $G4/4 )

    Current Logic:
    (If the Qtr date is past the lease expiry date or lease break date) _or_ (the QTR date is <= the lease expiry date, void for #void periods specified in column J)
    (the QTR date is <= the lease break date, void for #void periods specified in column J)
    If TRUE = VOID
    If FALSE = Rent Amount (Column G/4)
    _____________________________________________________________________________
    Things I would like to add to formula/Expected Results:

    • Only include Void periods if break options are exercised, i.e. only include void periods if column D = “Yes”, if not then no void periods should apply.
    If column D1 = “Yes”, or if lease expires, we need to be able to define the following:
    • Post Void period Expiry Date – rent to be reinstated with a new expiry date specified in column i.
    • Post void Rent value is to be reinstated at a level specified in column H.
    • Rent is currently pulling into the model before the start date specified in column C – this should only commence on or after the date specified in column C.
    • At the moment the model is voiding everything before the expiry date as well as correctly voiding the specified amount of periods per the j column, this needs to be fixed so that the void period only runs for the specified number of void periods.

    Note: A Number of cells are being populated by data entered in the “Data Input & Output” sheet.

    I understand there is probably quite a bit of work in this and can purchase points and offer them for completion if you guys think that would be more appropriate?
    Attached Files Attached Files

  13. #13
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,543

    Re: Help with a string of IF statements

    As to the following:
    • Only include Void periods if break options are exercised, i.e. only include void periods if column D = “Yes”, if not then no void periods should apply.
    • Rent is currently pulling into the model before the start date specified in column C – this should only commence on or after the date specified in column C.
    Try: =IF(K$2<$C4,"",IF(AND($D4="Yes",OR(K$2>$F4,K$2>$E4),OR(K$2<=EOMONTH($F4,$J4*3),K$2<=EOMONTH($E4,$J4*3))),"Void", $G4/4 ))
    As to the rest please manually include examples of the output you expect in each possible scenario and, unless it is obvious, please include explanations of the expected output.
    If the values in column D are pulling from the "Data Input & Output" sheet then data validation for the cells in column D is not needed.
    Let us know if you have any questions.

  14. #14
    Registered User
    Join Date
    06-24-2019
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 Pro Plus 64-Bit
    Posts
    13

    Re: Help with a string of IF statements

    Hi Jete,
    Thank you once again for looking at this, it is much appreciated. Apologies for my delayed response, I have been ill.

    I have now attached an updated sheet where I have populated row 7 manually with expected outcomes and included comments in each relevant cell in line with same.

    I probably didn’t articulate my desired outcome very well in my last post, allow me to clarify the remaining points below:

    If column D1 = “Yes”, or if lease expires, we need to be able to define the following:
    • Post Void period Expiry Date – rent to be reinstated with a new expiry date specified in column i. Following a void period which has run it’s course – the date per column I will now be the new expiry date. Essentially whether it’s the Lease Break Date (Column E) or Lease Expiry Date (Column F) that occur first, from this date the Void period will be served and following that the new Expiry date per column i should apply from thereon in.[/I][/I][/I][/I][/B]
    • Post void Rent value is to be reinstated at a level specified in column H. Following a void period which has run it’s course – the rental amount per column H will now be the new rental amount (this will feed from data input and output). The annualised amount will feed through to the sheet and will need to be divided by 4 to fit the quarterly model.
    The model is now voiding from the correct expiry/break date but voiding an incorrect number of periods (specified per the j column), this needs to be fixed so that the void period only runs for the specified number of void periods. EG, Row 5 – there should be 4 void quarters but instead there are 16.

    Thanks again

  15. #15
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,543

    Re: Help with a string of IF statements

    See if the following get closer to what you want:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Note that I left row 7 "as is" so that you could compare the results of the formula in row 8.
    Note that formula requires some date be placed in column I if column D displays "Yes".
    Let us know if you have any questions.

  16. #16
    Registered User
    Join Date
    06-24-2019
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 Pro Plus 64-Bit
    Posts
    13

    Re: Help with a string of IF statements

    Hi Jete,

    I've ran a few trials of this and it's 99% there, thanks a million.

    One small thing I've noticed is when the "lease break date" (Col E) is the same date as the last day in a period (the dates per row 2 - eg: 31/03/2020)the void period does not appear. I have attached an example of same with E6 demonstrating this, when I apply a different date which isn't the last day of a quarter then the model works fine and the void period present itself as it should.

    Do you know why this might be?.

    Thanks again
    Attached Files Attached Files

  17. #17
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,543

    Re: Help with a string of IF statements

    Assuming that M6 should show "Void" in this scenario, try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Let us know if you have any questions.

  18. #18
    Registered User
    Join Date
    06-24-2019
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 Pro Plus 64-Bit
    Posts
    13

    Re: Help with a string of IF statements

    That worked Jete, thanks again.

    One last thing and I'm sorry to be a pain, when the Post Void Lease Expiry (Column I) is passed the remainder of the row voids rather than voiding for the number of periods specified in column J. Is there any chance you could help with this?.

    Is there anyway I can make a financial contribution to you? I really appreciate the help.

  19. #19
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,543

    Re: Help with a string of IF statements

    Try selecting cell K4 and pasting the following into the formula bar:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Let us know if you have any questions.

  20. #20
    Registered User
    Join Date
    06-24-2019
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 Pro Plus 64-Bit
    Posts
    13

    Re: Help with a string of IF statements

    Hi Jete, Sorry to re-open this, I have been having an issue with the model whereby the number of void periods presented in Columns K - AD do not correspond with the number specified in Column J. I have attached an example, any help would be greatly appreciated, many thanks.
    Attached Files Attached Files

  21. #21
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,543

    Re: Help with a string of IF statements

    Re-opening is not a problem. Please manually place what you expect to see in rows 4:6 into three of the rows further down the sheet (i.e. rows 7:9) so that we will have something upon which to base the results of our formulas/code.
    In looking at this again, I am thinking that I will employ some helper columns, perhaps columns XEY:XFD. Will that be acceptable?
    Let us know if you have any questions.

  22. #22
    Registered User
    Join Date
    06-24-2019
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 Pro Plus 64-Bit
    Posts
    13

    Re: Help with a string of IF statements

    Thanks Jete, I have set out a bit more detail below and attached a version with expected outcomes:

    If "Column D- Break Exercised" is "YES" then - "Void" Periods should apply and follow the Lease Break date (specified in Column E) and Lease Expiry dates (specified in Column F) for the amount of periods specified in "Column J". If "Column D- Break Exercised" is "NO" then no void period period is exercised.

    Current Outcome Vs Expected Outcome with current formula.

    Current Outcome:
    - Row 4: The first void period is correct, 2 void periods as specified in "column J", the second Void period is showing 3 periods instead of 2 and beginning one period early.
    - Row 5: The First void period is beginning one period early and is showing two Void periods instead of one as specified in column J. The second void period beginning 30/05/2023 is not showing up.
    - Row 6: The two Void periods run into eachother and last for 7 periods rather than 2 seperate Voids for 3 periods each.

    Expected Outcome:
    - Row 4: Per Spreadsheet Row 7.
    - Row 5: Per Spreadsheet Row 8.
    - Row 6: Per Spreadsheet Row 9.
    Attached Files Attached Files

  23. #23
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,543

    Re: Help with a string of IF statements

    I believe that the date in column I must factor in as R9:T9 show void. Those dates do not follow either E9 or F9.
    If, in fact, the voids should have been in V9:X9 then a formula that will work is:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Let us know if you have any questions.

  24. #24
    Registered User
    Join Date
    06-24-2019
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 Pro Plus 64-Bit
    Posts
    13

    Re: Help with a string of IF statements

    Hi Jete, sorry to reopen this thread after so long. Your solution above almost worked. I would be so grateful if you have one more look at the attached - in example 1 - 2 void periods are showing up even though only 1 void period is specified in column J, would you have any idea why this might be? Thanks again so much.
    Attached Files Attached Files

  25. #25
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,543

    Re: Help with a string of IF statements

    "Void" Periods should apply and follow the Lease Break date (specified in Column E) and Lease Expiry dates (specified in Column F) for the amount of periods specified in "Column J".
    I guess that I am still confused. Based on the above from post #22, it would seem that since the lease break date for example 1 (12/9/2020) is in Q4 2020 that Q1 2021 should be as void and since the lease expiry date (2/10/2021) is in Q1 2021 that Q2 2021 should also show as void. I see that the formula is displaying void for the wrong quarters, just not sure why it should not show void for two quarters instead of one.

  26. #26
    Registered User
    Join Date
    06-24-2019
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 Pro Plus 64-Bit
    Posts
    13

    Re: Help with a string of IF statements

    Apologies Jete, You're quite right I was reading it wrong, Thanks again!

  27. #27
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,543

    Re: Help with a string of IF statements

    This proposal adds some helper columns (F:G and I:J) which may be hidden for aesthetic purposes. It also includes a helper row O33:AH33 which could be hidden by choosing white font.
    The helper columns F and I are populated using: =MATCH(E4,$O$33:$AH$33)+1
    The helper columns G and J are populated using: =F4+$N4-1
    The cells in row 33 are populated using: =EOMONTH(O2,-3)+1
    O4:AH6 are populated using:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Let us know if you have any questions.

+ 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. Difficulty With User Defined Functions (UDF) - Case Statements for String & Int
    By Deyeski in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-16-2017, 06:04 PM
  2. String of IF(And statements
    By ksky88 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-19-2017, 12:48 PM
  3. [SOLVED] Wanting to string multiple IF(AND) statements together
    By BBFDSue in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 03-27-2017, 02:06 PM
  4. [SOLVED] Select Case statements after Search String not working
    By rdowney79 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-10-2013, 03:04 PM
  5. Excel 2007 : Nested IF Statements and string text
    By katharineb in forum Excel General
    Replies: 5
    Last Post: 07-22-2010, 05:20 PM
  6. IF statements based on text in a string
    By giantwolf in forum Excel General
    Replies: 4
    Last Post: 12-12-2008, 11:50 AM
  7. Add multiple IF statements to a combined string of cells
    By littledobby in forum Excel General
    Replies: 1
    Last Post: 07-17-2008, 11:31 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