Forum Discussion

Hayche's avatar
Hayche
Copper Contributor
Apr 26, 2022
Solved

Help with nested IF AND function

Hi,   I've been working on the formula below for a long time and could really do with some help. Basically the formula is set to divide column H5 (80%) with column J5 (Duration) as long as the mont...
  • JoeUser2004's avatar
    JoeUser2004
    Apr 26, 2022

    Hayche  ....  I wrote:  ``I want to emphasize just how bad it is to use the end of the month``

     

    On second thought, looking at the formula in column L, it is clear that your intent is for columns L and M to contain end-of-month dates, if we can assume that column K always contains first-of-month dates, as it does.

     

    So, the simplest fix might be:

     

    =IF(AND(S4>=$K$5, S4<=$L$5), $H$5/$J$5, IF(EOMONTH(S4,0)=$M$5, $I$5/$J$5, ""))

     

    Alternatively, you could have end-of-month dates in R4:BL4.

     

    But in that case, the formulas in S4:BL4 should be changed from =EDATE(R4,1) to =EOMONTH(R4,1).

     

    (Compare the difference in S4 if R4 is 6/30/2022.)

     

    However, if you change R4:BL4 to end-of-month dates, I don't know how that might affect other dependent formulas in your original Excel file, assuming the attach Excel file is an excerpt.

Resources