Rounding issue with IF statement

bbpvhc

New Member
Joined
Jan 2, 2020
Messages
11
Office Version
  1. 365
Platform
  1. Windows
I am trying to create a calc worksheet for a pension plan. I need to calculate how many months someone is from being 60-years old in order to find a reduction rate in in a table. When working properly, the formula will look at the person's age, calculate how many months they are from being 60. Another cell will do a vlookup on the number of months to find the reduction rate. The problem I am having is that the result of the formula is not a true month. For example, the result might be 27.4 months. I need the next cell to look up 27 months and ignore the decimal. I was trying to include ROUNDDOWN in the formula so that the result is always an exact month, but I can't get it to work. Where would I put the ROUNDDOWN at? Is there a better way to achieve this?

=IF(E7<=60,(N8-E7)*12,"n/a")
Note: N8 is 60 and E7 is their age in years with one decimal. For example, 57.7 is in E7, which would be 27 months before age of 60. It is coming back as 27.6, so the vlookup can't find 27.6 because it needs to find 27.
 
It is not doing that for me
 

Attachments

  • Capture.PNG
    Capture.PNG
    25.6 KB · Views: 4
Upvote 0

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
It is not doing that for me. I can't even get that formula to work unless I delete the "n/a" portion. If I do delete the "n/a" portion, it returns as 28 still.
Capture.PNG
 
Upvote 0
My guess is that the value in E7 isn't exactly 57.7, just formatted that way.

So, try this:
=IF(E7<=60,INT((N8-TRUNC(E7,1))*12),"n/a")
 
Upvote 0
You're probably right. That's doing the same thing though. It won't calculate anything.
Capture.PNG
 
Upvote 0
Here is the formula in E7: =((YEAR(B6)-YEAR(B7))*12+MONTH(B6)-MONTH(B7)+IF(DAY(B7)=1,0,-1))/12

I tried to get that to load as a value in a different cell to go from there, but even =TEXT(E7,0) is rounding up. UGH!
 
Last edited:
Upvote 0
Why did you use TEXT? If you want to see what the cell actually contains format the cell as General.
That cell actually, like I said before doesn't contain 57.7, the actual value is 57.6666666666667. This is why your result is coming out incorrectly.
So, try this:
Change the formula you gave to =ROUND(((YEAR(B6)-YEAR(B7))*12+MONTH(B6)-MONTH(B7)+IF(DAY(B7)=1,0,-1))/12,1)

Book1
BCDEFG
157.6666666666667
257.7
3
4
5
67/1/2015
711/1/1957
Sheet1
Cell Formulas
RangeFormula
G1G1=((YEAR(B6)-YEAR(B7))*12+MONTH(B6)-MONTH(B7)+IF(DAY(B7)=1,0,-1))/12
G2G2=ROUND(((YEAR(B6)-YEAR(B7))*12+MONTH(B6)-MONTH(B7)+IF(DAY(B7)=1,0,-1))/12,1)
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,492
Members
448,967
Latest member
visheshkotha

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