Is there any better way to set out multiple IF statements?

KnAsTa

Board Regular
Joined
Apr 11, 2002
Messages
52
Cos i am using a formula with about 4 If statements in it, and i am finding it hard to read and it is getting quite confusing. :|
Thanx
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Yes



Check Help on boolean, Vlookup, HLookup, Lookup, Choose, etc.
 
Upvote 0
"If" statements can get very confusing and
hard to read, that's why the "real guys"
suggest using "select case" you may want to
it.

James
 
Upvote 0
On 2002-04-13 22:33, KnAsTa wrote:
So how do you write a formula using the VBA instead of the formula box?

Hi,

Please show us your formula (or describe in detail what you'd like to do).

Thanks,
Jay
 
Upvote 0
if you have multiple conditions and you want to use if statements. the best way is to use.

Select Case testexpression
[Case expressionlist-n
[statements-n]] ...
[Case Else
[elsestatements]]

End Select


you can see the how select statement can be used by taking on line help also


this is the best way to go.

ni****h desai
http://www.pexcel.com
 
Upvote 0
=IF(ISERROR(LOOKUP(A5,week1.xls!$A$1:$A$10,0)),IF(VLOOKUP(A5,week1.xls!$A$1:$D$10,3,0)>VLOOKUP(A5,week1.xls!$A$1:$D$10,4,0),3,0),IF(ISNA(LOOKUP(A5,week1.xls!$A$1:$D$10,4)>VLOOKUP(A5,week1.xls!$A$1:$D$10,3,0)),3,0))

Thats the formula using 3 IF statements.
Confusing?
 
Upvote 0

Forum statistics

Threads
1,213,527
Messages
6,114,142
Members
448,551
Latest member
Sienna de Souza

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