Nested if formula

SuzyQPA2

Board Regular
Joined
Oct 28, 2004
Messages
90
I have a formula and it works but i'd like to tweak it and can't seem to get it.

Here's the formula.
IF(YEAR(C4)=2017,IF(MONTH(C4)=1,F4*1.5%,IF(MONTH(C4)=2,F4*1.25%,IF(MONTH(C4)=3,F4*1%,IF(MONTH(C4)=4,F4*0.75%,IF(MONTH(C4)=5,F4*0.5%,IF(MONTH(C4)=6,F4*0.25%,0)))))))

Basically the formula says if the year is 2017 and the month is January - June, return the corresponding % increase.
Gripes:

I'd also like it to check another cell (j4)and see if the text says "per-diem" if yes then i want it to return zero, if no then continue with the formula.

If you can shorten the formula be my guest ;)
 
So, what should the formula show if the date is July-Dec? 0? Blank? F4 value with no increase?
 
Upvote 0

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
If I am not mistaken, then the formula provided by johnmpl already returns a 0 if the date is after June.
 
Upvote 0
Your right, i'm working with two groups and got them confused, but i was able to tweak your formula to get it to work, what if your formula is june-dec how do i get 0 answer
 
Upvote 0
Your right, i'm working with two groups and got them confused, but i was able to tweak your formula to get it to work, what if your formula is june-dec how do i get 0 answer

I was just thinking of that because I couldn't think of how to modify the MAX portion, it works so well as it is with 6 numbers... but I modified mine to account for the months after May.

=IF(AND(YEAR(C4)=2017,J4<>"per-diem"),F4*LOOKUP(MONTH(C4),{1,2,3,4,5,6},{0.015,0.0125,0.01,0.0075,0.005,0}),0)

The last number in the LOOKUP ".0025" should be a 0 as shown here in this version.
 
Last edited:
Upvote 0
You could skip the AND if returning 0 is acceptable

=(YEAR(C4)=2017)*(J4<>"per-diem")*F4*LOOKUP(MONTH(C4),{1,2,3,4,5,6},{0.015,0.0125,0.01,0.0075,0.005,0})
 
Upvote 0

Forum statistics

Threads
1,215,273
Messages
6,123,985
Members
449,137
Latest member
abdahsankhan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top