# If condition

#### Arup Dutta Chowdhury

##### Member
I have an excel sheet where difference between two dates is given in tenure column. Now I want to make a slab that if somebody has worked for less than 1 year it will be zero. If somebody worked for 2 years he will 1-2 years slab. If somebody worked for 3 Years he will be in 2-3 years slab. and if he has worked for more than 3 years he will be in >3 years slab. Please help .

#### Attachments

• 9.6 KB Views: 8

#### Marcilio

##### New Member
Arup Dutta Chowdhury, Good afternoon.

Try to use:

E2 --> =IF(--LEFT(D2;1)>3;">3 years";IF(--LEFT(D2;1)=3;"2-3 years";IF(--LEFT(D2;1)>=1;"1-2 years";0)))

Please, tell us if it worked as you desire.

I hope it helps.

#### Attachments

• 10.3 KB Views: 3

#### Attachments

• 10.1 KB Views: 7

#### Peter Bartholomew

##### Well-Known Member
Using Excel 365, columns C and D could read
Code:
``````= DATEDIF(joined, left,"y")  & "Year" &
DATEDIF(joined, left,"ym") & "Months"

and

= SWITCH(
DATEDIF(joined,left,"y"),
0, "zero",
1, "1-2 years",
2, "2-3 years",
">3 years" )``````