?
Solved

if statement help

Posted on 2011-04-27
12
Medium Priority
?
224 Views
Last Modified: 2012-05-11
Can you please provide me when the if statement that I can use in Excel to use the following logic?
If X < 365 then  y= 0
If  X>= 365 and <= 1875 then  y= (x/26)*15
If X > 1875 then y =(x/26)*20

Regards
Dina
0
Comment
Question by:dina78
  • 4
  • 3
  • 2
  • +3
12 Comments
 
LVL 2

Expert Comment

by:balatheexpert
ID: 35474166
If X < 365 then  y= 0
If  X>= 365 and <= 1875 then  y= (x/26)*15
If X > 1875 then y =(x/26)*20

Here You Go:
----------------------
If (x < 36) Then
y = 0
ElseIf (x >= 365 And x <= 1875) Then
y = (x / 26) * 15
ElseIf (x > 1875) Then
y = (x / 26) * 20
End If


thanks,
bala
0
 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 35474197
=IF(A1 < 365;0;IF (A1<= 1875;(A1/26)*15;(A1/26)*20))
0
 

Author Comment

by:dina78
ID: 35474198
hello Bala,
im actually looking for the way the IF esle  is used in Excel where you have to use =IF( A1 <365,0,,,,,,,) and so on
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 35474200
=IF(A1 < 365;0;IF (A1<= 1875;(A1/26)*15;(A1/26)*20))
see attache file test.ods
0
 
LVL 10

Expert Comment

by:gavsmith
ID: 35474204
Do you mean in the cells where X might be a cell for example A1?

if so B1 formula:

=IF(A1<365,0,IF(A1<=1875,(A1/26)*15,(A1/26)/20))
0
 
LVL 10

Expert Comment

by:gavsmith
ID: 35474209
Opps I was slow typing that out sorry for repeat post.
0
 
LVL 34

Accepted Solution

by:
Rob Henson earned 2000 total points
ID: 35474216
Assuming you want it as a formula, enter it into the cell in which you want the value y as the result and x referring to another cell:

=IF(x<365,0,IF(AND(x>=365,x<=1875),(x/26)*15,(x/26)*20))

Cheers
Rob H
0
 
LVL 10

Expert Comment

by:gavsmith
ID: 35474218
Plus there's a type fault in mine after taking so long, lol, I give up...

=IF(A1<365,0,IF(A1<=1875,(A1/26)*15,(A1/26)*20))
0
 
LVL 50

Expert Comment

by:barry houdini
ID: 35474232
As it's only the multiplier that changes you could use this version

=IF(A1<365,0,IF(A1<=1875,15,20))*A1/26

regards, barry
0
 
LVL 2

Expert Comment

by:balatheexpert
ID: 35474287

the way this looked and the term "statement" u used made me assume u need code.. ;)

let's assume a1 is having the value of x:

If X < 365 then  y= 0
If  X>= 365 and <= 1875 then  y= (x/26)*15
If X > 1875 then y =(x/26)*20

=IF(A1<365,0,IF(AND(A1>=365,A1<=1875),(A1/26)*15,IF(A1>1875,(A1/26)*20)))

this will return the value to the current cell!!!!!!!!!!!!!!!!!!

let me know if it helps!!!
0
 
LVL 10

Expert Comment

by:gavsmith
ID: 35474310
keep it simple, you don't need the AND 'x>=365'... you already know that is true because <365 is false!
0
 
LVL 2

Expert Comment

by:balatheexpert
ID: 35475649
yea!! right!!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question