Conditional formula

EduPAz

Board Regular
Joined
Mar 18, 2017
Messages
69
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Hi,

Can someone please help me with this formula?

I have this info:
Column A = employee name
Column B = hiring day
Column C = vacation start date
**Column D = Xtra vacation days
Column E = Value from column D + 15 (default)


**If an employee has worked more than 4 years, put in column D 1 day
If an employee has worked more than 5 years, put in column D 2 days
If an employee has worked more than 5, 6, 7..., put in column D 3 days. The maximum number of xtra days is 3

Thanks,

Edu
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
If an employee has worked more than 5 years, put in column D 2 days
If an employee has worked more than 5, 6, 7..., put in column D 3 days. The maximum number of xtra days is 3

Hi,

Please clarify above in red for 5 years.
 
Upvote 0
Hi,

Sorry, my mistake.

It will be like this:

If an employee has worked 6 years, put in Column D 2 days
If an employee has worked 7 or more years, put in Column D 3 days. The maximum number of xtra days is 3
 
Upvote 0
Thanks for clarifying.

You can use a Nested IF statement like D2,
Or, use a LOOKUP formula with your requirements "hard-coded" in the formula,
Or, use the LOOKUP formula referencing your requirements in a Table (H2:I5 in my sample), this is more flexible if the requirements might change, just change them in the Table:


Book1
ABCDEFGHI
1NameHire DateV Start DateXtra V Daysyearsdays
2John Doe1/15/201511100
3Jane Doe3/2/201133341
4Jack Doe12/1/201700062
5Jill Doe12/30/201222273
Sheet515
Cell Formulas
RangeFormula
D2=IF(EDATE(B2,84)<=TODAY(),3,IF(EDATE(B2,72)<=TODAY(),2,IF(EDATE(B2,48)<=TODAY(),1,0)))
E2=LOOKUP(YEARFRAC(B2,TODAY(),1),{0,4,6,7},{0,1,2,3})
F2=LOOKUP(YEARFRAC(B2,TODAY(),1),H$2:H$5,I$2:I$5)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,243
Messages
6,123,837
Members
449,129
Latest member
krishnamadison

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