how does the case comand work

hitch_hiker

Active Member
Joined
Feb 21, 2012
Messages
294
I see answers to problems using 'case' , I think this is exactly what I need , but I don't know how to set it up and the syntax, does the case have numeric values or can they be text. I'm hoping to avoid nested if's , maybe even nested ifs within nested ifs
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Excel's Help on the Select Case Statement is fairly good.
There is one trick it doesn't mention, you can have the likes of:
Code:
Select Case [COLOR=#0000ff]True[/COLOR]
   Case x=y
    'do something
   Case zz="Easter"
    do something else
   Case Month(Date)=12
    'do something
End Select
 
Upvote 0
thanks P45cal,
I never seem to get any real help from help, One more thing, can I have
Code:
case x=1 and zz = 3
 
Upvote 0
thanks p45cal,
I meant If(x=1 and zz=3) then.... , I will look at all those links later. I tend to forget about google for this type of help, even though it was google that pointed me to mrexcel.
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

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