您请求访问的页面目前没有您的语言版本。您可以从页面底部选择其他语言,或使用 Google Chrome 的内置翻译功能将网页内容即时翻译成您选择的语言。

SWITCH()

Choose-one conditional evaluation

Returns the results of an expression corresponding to the first matching value when evaluating one value against a list of values, or the results of the default expression if there is no match.

Sample usage

SWITCH([Date],TODAY(),"Today",(TODAY() - 1),"Yesterday",(TODAY() + 1),"Tomorrow", TEXT([Date])) returns a user-friendly date string, such as Today, Yesterday, or Tomorrow.

SWITCH([Color], "Red", 3, "Yellow", 2, "Green", 1, 0) returns a numeric value based on the color value.

SWITCH([Access Required], "Admin", IN(USEREMAIL(), Admin Users[Email]), "User", IN(USEREMAIL(), Users[Email]), FALSE) returns the role required for access.

SWITCH(CONTEXT("Host"), "Device", "Tap below to:", "Browser", "Click below to:", "") returns different directions depending on whether the app is running from the native app on a device or from a browser. This might be used to generate a display name for a gallery view of launchers. See also: CONTEXT()

Syntax

SWITCH(expression, case1, value1, [case2, value2 ...], default)

  • expression - Value or expression of any type.
  • case1 - First condition to be checked against value. Must be comparable type to value.
  • value1 - Expression that is evaluated and returned if case1 is a match.
  • case2, value2 … (Optional) Additional conditions and expressions if the first one doesn’t match the expression.
  • default - An expression that is evaluated and returned if no match is found.
Note: Every result expression should produce a value of the same type.

 

Was this helpful?

How can we improve it?
true
Search
Clear search
Close search
Main menu
3111492949662267672
true
Search Help Center
false
true
true
true
false
false
false
false
false
⌂ 换网址