morinia
asked on
Modifying if statement in Excel
Experts,
I have an if statement throughout a spreadsheet which only caculates the value if it is the month is less than the current month. It worked fine, until I tried to calculate December which is greater than January. I had not included year in the "if statement".
This is my statement,
=IF( MONTH(1&"-"&E$7) < MONTH(TODAY()),SUMIFS(MCLA IMS,MMONTH ,MONTH(1&" -"&E$7),ME DIT,$C9),0 )
Can someone tell me the best way to modify this statement so it will work all year, including December
I have an if statement throughout a spreadsheet which only caculates the value if it is the month is less than the current month. It worked fine, until I tried to calculate December which is greater than January. I had not included year in the "if statement".
This is my statement,
=IF( MONTH(1&"-"&E$7) < MONTH(TODAY()),SUMIFS(MCLA
Can someone tell me the best way to modify this statement so it will work all year, including December
ASKER
Sorry, E7 has "JAN" G7 = "FEB" I7 = "MAR" K7 = "APR" ........
Bascially it just allows the same formula to be used throughout the columns. When the formula is copied from one column to the next it works.
The part of the statement that needs adjusting is, I need to add an "OR" to the if
That code was given by an "expert" a while back.
I am starting to try it myself, I have to test I came up with this so far
=IF(OR( MONTH(1&"-"&E$7) < MONTH(TODAY(), MONTH(TODAY() - 1 = 0) ),SUMIFS(MCLAIMS,MMONTH,MO NTH(1&"-"& E$7),MEDIT ,$C9),0)
Bascially it just allows the same formula to be used throughout the columns. When the formula is copied from one column to the next it works.
The part of the statement that needs adjusting is, I need to add an "OR" to the if
That code was given by an "expert" a while back.
I am starting to try it myself, I have to test I came up with this so far
=IF(OR( MONTH(1&"-"&E$7) < MONTH(TODAY(), MONTH(TODAY() - 1 = 0) ),SUMIFS(MCLAIMS,MMONTH,MO
I suspect it would be easier to compare whole dates rather than just months. Dates can be rounded up to the end of the month using EOMONTH function. I will take another look when back at PC.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Experts,
I was able to get it to work with this formula:
=IF(OR( MONTH(1&"-"&E$7) < MONTH(TODAY()),MONTH(TODAY ()=1)),SUM IFS(MCLAIM S,MMONTH,M ONTH(1&"-" &E$7),MEDI T,$C9),0)
This will get me through December. I hope it works in February for January.
I was able to get it to work with this formula:
=IF(OR( MONTH(1&"-"&E$7) < MONTH(TODAY()),MONTH(TODAY
This will get me through December. I hope it works in February for January.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I had to make a slight modification to make it work.
MONTH(1&"-"&E$7)
supposed to evaluate too?
what do you have in E7?