Help with formula

mazher

Active Member
Joined
Nov 26, 2003
Messages
363
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hi,

I am using this formula

=IF(E2<=0,"Expired",IF(E2<=7,"1 Weeks Left",IF(E2<=14,"2 Weeks Left",IF(E2<=21,"3 Weeks Left",IF(E2<=30,"4 Weeks Left",IF(E2<=60,"2 Months Left","More Than 3 Month"))))))

e2<= 0 its expired
e2 = 1 to 6 than "Less than a week"
e2 = 7 to 13 then "Less than 2 weeks"
e2= 14 to 20 then "Less than 3 weeks
e2= 21 to 31 then "Less than month"
e2= 32 to 60 then "Less than 2 months"
e2= 61 to 90 "Less than 3 months"

else " More than 3 Months


Can some one help me constructing this =if() or some better approach.

Regards

Mazher
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Maybe try something like this...

Code:
=LOOKUP(E2,{-9.99999999999999E+307,1,8,15,22,29,61},
      {"Expired","Less than a week","Less than 2 weeks","Less than 3 weeks","Less than 4 weeks","Less than 2 months","More Than 2 Months"})
 
Last edited:
Upvote 0
Thanks.

Can u plz explain what this formula is doing?

Regards


Mazher
 
Upvote 0
Hi Mazher,

If you look in Excel help for the Lookup function it has a great explanation which should help you understand what's going on.

Especially take a look at the Array form of the Lookup and Example 2.
 
Upvote 0
Hi,

I am using this formula

=IF(E2<=0,"Expired",IF(E2<=7,"1 Weeks Left",IF(E2<=14,"2 Weeks Left",IF(E2<=21,"3 Weeks Left",IF(E2<=30,"4 Weeks Left",IF(E2<=60,"2 Months Left","More Than 3 Month"))))))

e2<= 0 its expired
e2 = 1 to 6 than "Less than a week"
e2 = 7 to 13 then "Less than 2 weeks"
e2= 14 to 20 then "Less than 3 weeks
e2= 21 to 31 then "Less than month"
e2= 32 to 60 then "Less than 2 months"
e2= 61 to 90 "Less than 3 months"
else " More than 3 Months


Can some one help me constructing this =if() or some better approach.

Regards

Mazher
If I were you I'd setup a lookup table.

AlphaFrog's formula doesn't follow your levels exactly.
 
Upvote 0
How about something like this...

Excel Workbook
ABCDEF
1DaysOutcome**DaysTime to take action
20"Expired"**40"Less than 2 months"
31"Less than a week"**0"Expired"
47"Less than 2 weeks"**6"Less than a week"
514"Less than 3 weeks**14"Less than 3 weeks
621"Less than month"**22"Less than month"
732"Less than 2 months"**33"Less than 2 months"
861"Less than 3 months"**65"Less than 3 months"
9****13"Less than 2 weeks"
10****2"Less than a week"
11****7"Less than 2 weeks"
12****6"Less than a week"
Sheet2
<table style="font-family:Arial; font-size:10pt; border-style: groove ;border-color:#00ff00;background-color:#fffcf9; color:#000000; "><tr><td ><b>Spreadsheet Formulas</b></td></tr><tr><td ><table border = "1" cellspacing="0" cellpadding="2" style="font-family:Arial; font-size:9pt;"><tr style="background-color:#cacaca; font-size:10pt;"><td >Cell</td><td >Formula</td></tr><tr><td >F2</td><td >=LOOKUP(E2,$A$2:$A$8,$B$2:$B$8)</td></tr></table></td></tr>Copy down as needed....</table>
 
Upvote 0
Thanks All,

T. Valko can u please tell me how to do that.

Regards

Mazher
 
Upvote 0
Thanks All,

T. Valko can u please tell me how to do that.

Regards

Mazher
e2<= 0 its expired
e2 = 1 to 6 than "Less than a week"
e2 = 7 to 13 then "Less than 2 weeks"
e2= 14 to 20 then "Less than 3 weeks
e2= 21 to 31 then "Less than month"
e2= 32 to 60 then "Less than 2 months"
e2= 61 to 90 "Less than 3 months"
else " More than 3 Months
OK, your first level is <=0. Does that mean it's possible that E2 might be a negative number?
 
Upvote 0
yes it can be less than zero,

As its calculating the difference between two dates which can be negative
 
Upvote 0
yes it can be less than zero,

As its calculating the difference between two dates which can be negative
Ok, this table:

Book1
ABC
1FromToStatus
2-10000000Expired
316Less than a week
4713Less than 2 weeks
51420Less than 3 weeks
62131Less than a month
73260Less than 2 months
86190Less than 3 months
991>91More than 3 Months
Sheet1

Conforms to this set of rules:

e2<= 0 its expired
e2 = 1 to 6 than "Less than a week"
e2 = 7 to 13 then "Less than 2 weeks"
e2= 14 to 20 then "Less than 3 weeks
e2= 21 to 31 then "Less than month"
e2= 32 to 60 then "Less than 2 months"
e2= 61 to 90 "Less than 3 months"
else " More than 3 Months
Although you really don't need column B in the table it makes it easier to find the exact level you're looking for.

E2 = some number of days

Enter this formula F2:

=LOOKUP(E2,A2:C9)
 
Upvote 0

Forum statistics

Threads
1,224,584
Messages
6,179,687
Members
452,938
Latest member
babeneker

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