Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default Case Statements in Excel 2003

Stupid question, but is it possible to do a Case statement in Excel
2003? I can do an IF with no problem, but I need to test a field to
see if it meets about a dozen criteria, and it freaks out if I nest
more than 5 IF statements.

I've looked this up and found a few folks doing this in VB Script, but
given I've never done VBS in Excel, I don't even know where to begin
on that front if that's the only way.

Thanks in advance for any suggestions --

Alex
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Case Statements in Excel 2003

Sub routine()
v = ActiveCell.Value
Select Case v
Case "dog"
MsgBox ("a mammal")
Case "rose"
MsgBox ("a flower")
Case "guppy"
MsgBox ("a fish")
End Select
End Sub

--
Gary''s Student - gsnu2007g


"Alex" wrote:

Stupid question, but is it possible to do a Case statement in Excel
2003? I can do an IF with no problem, but I need to test a field to
see if it meets about a dozen criteria, and it freaks out if I nest
more than 5 IF statements.

I've looked this up and found a few folks doing this in VB Script, but
given I've never done VBS in Excel, I don't even know where to begin
on that front if that's the only way.

Thanks in advance for any suggestions --

Alex

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default Case Statements in Excel 2003

On Apr 3, 11:49*am, Gary''s Student
wrote:
Sub routine()
v = ActiveCell.Value
Select Case v
Case "dog"
* * MsgBox ("a mammal")
Case "rose"
* * MsgBox ("a flower")
Case "guppy"
* * MsgBox ("a fish")
End Select
End Sub

--
Gary''s Student - gsnu2007g


Hi Gary,

Thanks for the reply, but this doesn't help much. Where would I plug
this or similar code into a spreadsheet to execute?

Thanks again - Alex
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Case Statements in Excel 2003

Maybe you could put your list of criteria in a column in a different worksheet
and whatever you want associated with each value in the adjacent cell. I'd use
A1:B12 (about).

Then I could use =vlookup() to retrieve that associated value.

Debra Dalgleish has lots of notes on =vlookup():
http://www.contextures.com/xlFunctions02.html (for =vlookup())

Alex wrote:

Stupid question, but is it possible to do a Case statement in Excel
2003? I can do an IF with no problem, but I need to test a field to
see if it meets about a dozen criteria, and it freaks out if I nest
more than 5 IF statements.

I've looked this up and found a few folks doing this in VB Script, but
given I've never done VBS in Excel, I don't even know where to begin
on that front if that's the only way.

Thanks in advance for any suggestions --

Alex


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2003 case sensitive problems with New Database Query havrek Excel Discussion (Misc queries) 1 March 7th 08 05:17 PM
Excel 2003 can't do case sensitive sorting! TelcordiaJack Excel Discussion (Misc queries) 3 October 10th 06 09:14 PM
how do i change a case to proper text in excel 2003 BBD Excel Worksheet Functions 1 September 20th 06 01:21 AM
Changing case on mailing lists I receive in Excel 2003? Walt Excel Worksheet Functions 1 July 22nd 05 04:27 PM
does anyone have the excel 2003 tutorial 3 case 4 (ortitiz marine. topgunsaby Excel Discussion (Misc queries) 0 December 10th 04 12:29 AM


All times are GMT +1. The time now is 08:35 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"