Share this page:

MS Excel: CHOOSE Function (WS, VBA)

Learn how to use the Excel CHOOSE function with syntax and examples.

Description

The Microsoft Excel CHOOSE function returns a value from a list of values based on a given position.

Syntax

The syntax for the Microsoft Excel CHOOSE function is:

CHOOSE( position, value1, [value2, ... value_n] )

Parameters or Arguments

position is position number in the list of values to return. It must be a number between 1 and 29.

value1, value2, ... value_n is a list of up to 29 values. A value can be any one of the following: a number, a cell reference, a defined name, a formula/function, or a text value.

Note

  • If position is less than 1, the CHOOSE function will return #VALUE!.
  • If position is greater than the number of the number of values in the list, the CHOOSE function will return #VALUE!.
  • If position is a fraction (not an integer value), it will be converted to an integer by dropping the fractional component of the number.

Applies To

The CHOOSE function can be used in the following versions of Microsoft Excel:

  • Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000

Type of Excel Function

The CHOOSE function can be used in Microsoft Excel as the following type of function:

  • Worksheet function (WS)
  • VBA function (VBA)

Example (as Worksheet Function)

Let's look at some Excel CHOOSE function examples and explore how to use the CHOOSE function as a worksheet function in Microsoft Excel:

Microsoft Excel

Based on the spreadsheet above, the following Excel CHOOSE examples would return:

=CHOOSE(1, A1, A2, A3, A4)
Result: "Tech"

=CHOOSE(1, "Tech", "on", "the", "Net")
Result: "Tech"

=CHOOSE(2, A1, A2, A3, A4)
Result: "on"

=CHOOSE(3, A1, A2, A3, A4)
Result: "the"

=CHOOSE(4, A1, A2, A3, A4)
Result: "Net"

=CHOOSE(5, A1, A2, A3, A4)
Result: #VALUE!

=CHOOSE(3.2, A1, A2, A3, A4)
Result: "the"

=CHOOSE(3.75, A1, A2, A3, A4)
Result: "the"

Example (as VBA Function)

The CHOOSE function can also be used in VBA code in Microsoft Excel.

Let's look at some Excel CHOOSE function examples and explore how to use the CHOOSE function in Excel VBA code:

Dim LValue As String

LValue = Choose(1, "Tech", "on", "the", "Net")

In this example, the variable called LValue would contain "Tech" as a value.

Frequently Asked Questions

Question: In Microsoft Excel, my question concerns formatting numbers in a particular cell. For example, the cell says:

="Gas price: $" & CHOOSE(gas.deck, B1, B2, B3) & "per mmbtu"

But returns $3 when the cell is formatted to two decimals. If the price were $3.25, the correct price would show. Any help would be greatly appreciated.

Answer: Even though your cell is formatted with a number format, your formula is returning text not a numeric value so the number format will not be applied. You will need to apply the format to the number inside of the formula.

You could try using the DOLLAR function to apply the format as follows: (you will need to remove your $ sign because the DOLLAR function will insert one automatically)

="Gas price: " & DOLLAR(CHOOSE(gas.deck, B1, B2, B3)) & "per mmbtu"

This formula should now return something like:

Gas price: $3.25per mmbtu