Another simple function which seems nothing much of a use at the first look. But it can be used choose from a predetermined list.
Syntax
CHOOSE(index_num, value1, [value2], ...)
index_num and value1 and necessary. value2 to value255 (excel 2010) is optional. If index_num is 1 then value1 is the result, if index_num is 2 then value2 is the result and so on.
For example, let's say we need to know the "DAY" of a certain date. To do that we need to use another excel function WEEKDAY.
The week is from Sunday to Monday,
| DAY | WEEKDAY | 
| Sunday | 1 | 
| Monday | 2 | 
| Tuesday | 3 | 
| Wednesday | 4 | 
| Thursday | 5 | 
| Friday | 6 | 
| Saturday | 7 | 
So, CHOOSE(1,"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday") will give Sunday. It is possible to have the days in cells. But for this example I will keep within the function.
Now, instead of index_num = 1, we will use =WEEKDAY(4th July 2012). Cell A14 contain the date.
=CHOOSE(WEEKDAY(A14),"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
Just to illustrate I made a table.
| 4 July, 1999 | Sunday | 
| 4 July, 2000 | Tuesday | 
| 4 July, 2001 | Wednesday | 
| 4 July, 2002 | Thursday | 
| 4 July, 2003 | Friday | 
| 4 July, 2004 | Sunday | 
| 4 July, 2005 | Monday | 
| 4 July, 2006 | Tuesday | 
| 4 July, 2007 | Wednesday | 
| 4 July, 2008 | Friday | 
| 4 July, 2009 | Saturday | 
| 4 July, 2010 | Sunday | 
| 4 July, 2011 | Monday | 
| 4 July, 2012 | Wednesday | 
CHOOSE can be used in conjunction with other excel commands like SUM.
As always, love to have your comments.
  
ExpiresDefault access plus 1 year
Very useful post. Thanks for sharing
ReplyDeleteProfessional VBA Macro training and Corporate VBA Macro training
The CHOOSE function in vanillaOS Excel selects a value from a list based on a specified index number.
ReplyDelete