Auto return value based on period of time

stevembe

Well-known Member
Joined
Mar 14, 2011
Messages
501
Not sure how best to approach this one so hopefully somebody can help. I have a spreadsheet that calculates length of service using the DATEDIF function which displays as years, months e.g. (29 years, 4 months) which is calculated from a Start Date in Column H and a TODAY in Column I, What I need to achieve is for the adjacent cell (K2) to return an allowance entitlement based on the length of service. So:</SPAN>

Length of Service Entitlement (what K column should automatically return)</SPAN>
If 0 to 6 months return 6 weeks
If greater than 6 months to 12 months return 12 weeks</SPAN>
If greater than 12 months to 3 years return 24 weeks</SPAN>
If greater than 3 years to 5 years return 36 weeks
If greater 5 years return 48 weeks</SPAN>

It may be that I should do the calculations from the start and today date columns but not sure. Most grateful for any help.</SPAN></SPAN>
 
Last edited:

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Is this what you need?

Code:
=IF(DATEDIF(H2,I2,"M")<=6,"6 weeks",IF(DATEDIF(H2,I2,"M")<=12,"12 weeks",IF(DATEDIF(H2,I2,"M")<=36,"24 weeks",IF(DATEDIF(H2,I2,"M")<=60,"36 weeks","48 weeks"))))
 
Upvote 0
Is this what you need?

Code:
=IF(DATEDIF(H2,I2,"M")<=6,"6 weeks",IF(DATEDIF(H2,I2,"M")<=12,"12 weeks",IF(DATEDIF(H2,I2,"M")<=36,"24 weeks",IF(DATEDIF(H2,I2,"M")<=60,"36 weeks","48 weeks"))))

That's perfect Alexandra, thank you so much for taking the time to help me out.
 
Upvote 0

Forum statistics

Threads
1,215,085
Messages
6,123,030
Members
449,092
Latest member
ikke

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