{"id":2777,"date":"2020-12-16T14:08:20","date_gmt":"2020-12-16T13:08:20","guid":{"rendered":"https:\/\/importsheet.com\/?p=2777"},"modified":"2025-12-17T23:38:21","modified_gmt":"2025-12-17T22:38:21","slug":"formula-de-cambio-google-sheets","status":"publish","type":"post","link":"https:\/\/www.sheetgo.com\/es\/blog\/google-sheets-formulas\/switch-formula-google-sheets\/","title":{"rendered":"C\u00f3mo utilizar la funci\u00f3n SWITCH en Google Sheets"},"content":{"rendered":"<p>[et_pb_section fb_built=&#8221;1&#8243; admin_label=&#8221;section&#8221; module_class=&#8221;sheetgo-post&#8221; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;15px||||false|false&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221; da_is_popup=&#8221;off&#8221; da_exit_intent=&#8221;off&#8221; da_has_close=&#8221;on&#8221; da_alt_close=&#8221;off&#8221; da_dark_close=&#8221;off&#8221; da_not_modal=&#8221;on&#8221; da_is_singular=&#8221;off&#8221; da_with_loader=&#8221;off&#8221; da_has_shadow=&#8221;on&#8221; da_disable_devices=&#8221;off|off|off&#8221;][et_pb_row admin_label=&#8221;row&#8221; _builder_version=&#8221;4.16&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221; theme_builder_area=&#8221;post_content&#8221;][et_pb_text _builder_version=&#8221;4.24.1&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">This <\/span><span style=\"font-weight: 400;\">Google Sheets SWI<\/span><span style=\"font-weight: 400;\">TCH evaluates an expression against a set of specific cases. The first case to evaluate as TRUE will return a corresponding value. If all cases are FALSE, the formula can return a default value.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The function works similarly to nested IF functions. But its syntax is much simpler, making it easy for anyone to read formulas in a spreadsheet.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">It\u2019s difficult to fully grasp this function without seeing some examples. But it\u2019s worth the investment to learn how to use it.<\/span><\/p>\n<p>[\/et_pb_text][et_pb_text module_id=&#8221;syntax&#8221; _builder_version=&#8221;4.24.1&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h2>Syntax<\/h2>\n<p>[\/et_pb_text][et_pb_text module_class=&#8221;spreadsheet-function&#8221; _builder_version=&#8221;4.16&#8243; border_width_left=&#8221;4px&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p>=SWITCH(logical_expression, case1, value1, [case2, value2]\u2026, default)<\/p>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.24.1&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>logical_expression<\/b><span style=\"font-weight: 400;\">\u2013 the expression to evaluate as TRUE or FALSE. This is what the function will test against each case.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>case1<\/b><span style=\"font-weight: 400;\"> \u2013 the first case to evaluate against the logical_expression.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>value1<\/b><span style=\"font-weight: 400;\"> \u2013 the value the function returns if case1 is TRUE.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>case2 <\/b><span style=\"font-weight: 400;\">\u2013 the second case to evaluate against the logical_expression.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>value2 <\/b><span style=\"font-weight: 400;\">\u2013the value the function returns if case2 is TRUE.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>default<\/b><span style=\"font-weight: 400;\">\u2013 the value to return if all the cases are FALSE.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">The logic behind this function is illustrated in the flowchart below.<\/span><\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2020\/12\/Switch-image-1.png&#8221; alt=&#8221;switch-function-google-sheets-1&#8243; title_text=&#8221;switch-function-google-sheets-1&#8243; module_class=&#8221;sheetgo-post-no-shadow-img&#8221; _builder_version=&#8221;4.23.1&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text module_id=&#8221;how&#8221; _builder_version=&#8221;4.24.1&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h2><span style=\"font-weight: 400;\">How to use the SWITCH function<\/span><\/h2>\n<h3><span style=\"font-weight: 400;\">Example 1: Basic use<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Let\u2019s start with the standard version of the function, and take a look at how it works. <\/span><\/p>\n<p>[\/et_pb_text][et_pb_text module_class=&#8221;spreadsheet-function&#8221; _builder_version=&#8221;4.24.1&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">=SWITCH(A2, 1, \u201dAlex\u201d, 2, \u201dBob\u201d, 3, \u201dCharlie\u201d, \u201dNone\u201d)<\/span><\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2021\/06\/SWITCH-FORMULA-GOOGLE-SHEETS-1.png&#8221; alt=&#8221;SWITCH FORMULA GOOGLE SHEETS 1&#8243; title_text=&#8221;SWITCH FORMULA GOOGLE SHEETS 1&#8243; align=&#8221;center&#8221; module_class=&#8221;sheetgo-post-no-shadow-img&#8221; _builder_version=&#8221;4.16&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.24.1&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">In this example, the expression is just \u20182\u2019. It is compared with all three cases, and it matches the second case so the function returns the text \u2018Bob\u2019.<\/span><\/p>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.24.1&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h3><span style=\"font-weight: 400;\">Example 2: Setting a default value<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Let\u2019s see what happens when none of the cases match the expression.<\/span><\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2021\/06\/SWITCH-FORMULA-GOOGLE-SHEETS-2.png&#8221; alt=&#8221;SWITCH FORMULA GOOGLE SHEETS 2&#8243; title_text=&#8221;SWITCH FORMULA GOOGLE SHEETS 2&#8243; align=&#8221;center&#8221; module_class=&#8221;sheetgo-post-no-shadow-img&#8221; _builder_version=&#8221;4.16&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.24.1&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">The expression \u20185\u2019 is FALSE for all three cases, and as a result the function returns the default value \u2018None\u2019.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">If you don\u2019t define a default value the SWITCH function <\/span><span style=\"font-weight: 400;\">produces an error, as shown below.<\/span><\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2021\/06\/SWITCH-FORMULA-GOOGLE-SHEETS-3.png&#8221; alt=&#8221;SWITCH FORMULA GOOGLE SHEETS 3&#8243; title_text=&#8221;SWITCH FORMULA GOOGLE SHEETS 3&#8243; align=&#8221;center&#8221; module_class=&#8221;sheetgo-post-no-shadow-img&#8221; _builder_version=&#8221;4.16&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.24.1&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h4><span style=\"font-weight: 400;\">Example 3: Matching weekdays with colors<\/span><\/h4>\n<p><span style=\"font-weight: 400;\">Say I\u2019ve planned out my wardrobe for the week, with a different color for every weekday.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Column D has various weekdays and in column E SWITCH matches the day of the week with the correct color.<\/span><\/p>\n<p>[\/et_pb_text][et_pb_text module_class=&#8221;spreadsheet-function&#8221; _builder_version=&#8221;4.24.1&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">=SWITCH(C2, A2, B2, A3, B3, A4, B4, A5, B5, A6, B6, \u201dNot a valid weekday\u201d)<\/span><\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2021\/06\/SWITCH-FORMULA-GOOGLE-SHEETS-4.png&#8221; alt=&#8221;SWITCH FORMULA GOOGLE SHEETS 4&#8243; title_text=&#8221;SWITCH FORMULA GOOGLE SHEETS 4&#8243; module_class=&#8221;sheetgo-post-no-shadow-img&#8221; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.24.1&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">The function here is long, but you can easily break it down into three parts:<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">The \u201cWhat day is it?\u201d column, basically what the function is looking for.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">After this, there are a series of case and value combinations. Each one declares that if the reference cell matches a weekday, then the function should output the corresponding color.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Finally, there is a default value (\u201cNot a valid weekday\u201d) if none of the cases match the logical expression.<\/span><\/li>\n<\/ol>\n<p>[\/et_pb_text][et_pb_text module_id=&#8221;should&#8221; _builder_version=&#8221;4.24.1&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h4>Should I use SWITCH or IF function?<\/h4>\n<p><span style=\"font-weight: 400;\">The following example illustrates the benefits of the SWITCH function when compared to the IF function. It adapts the formula to use IF instead of SWITCH.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The formula is noticeably more complicated.<\/span><\/p>\n<p>[\/et_pb_text][et_pb_text module_class=&#8221;spreadsheet-function&#8221; _builder_version=&#8221;4.24.1&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">=IF(C2 = A2, B2, IF(C2 = A3, B3, IF(C2 = A4, B4, IF(C2 = A5, B5, IF(C2 = A6, B6, &#8220;Not a valid weekday&#8221;)))))<\/span><\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2021\/06\/SWITCH-FORMULA-GOOGLE-SHEETS-5.png&#8221; alt=&#8221;SWITCH FORMULA GOOGLE SHEETS 5&#8243; title_text=&#8221;SWITCH FORMULA GOOGLE SHEETS 5&#8243; module_class=&#8221;sheetgo-post-no-shadow-img&#8221; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.24.1&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><b>Use IF to perform logical tests <\/b><span style=\"font-weight: 400;\">on your data. As this function can be used with logical expressions such as \u201csmaller than\u201d or \u201cgreater than\u201d.\u00a0<\/span><\/p>\n<p><b>Use SWITCH to work with exact matches<\/b><span style=\"font-weight: 400;\"> within a dataset, as it will help avoid complex nested IF statements<\/span><\/p>\n<p>[\/et_pb_text][et_pb_text module_id=&#8221;combining&#8221; _builder_version=&#8221;4.24.1&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h2><span style=\"font-weight: 400;\">Combining SWITCH with other functions<\/span><\/h2>\n<p>[\/et_pb_text][et_pb_text module_id=&#8221;month&#8221; _builder_version=&#8221;4.24.1&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h3><span style=\"font-weight: 400;\">Using <\/span><span style=\"font-weight: 400;\">SWITCH with MONTH<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Some date functions like MONTH return numbers that may be hard to interpret. You can use SWITCH to return more meaningful messages.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">To replace the month numbers returned by MONTH you can set a case for each of the 12 potential results.<\/span><\/p>\n<p>[\/et_pb_text][et_pb_text module_class=&#8221;spreadsheet-function&#8221; _builder_version=&#8221;4.24.1&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">=SWITCH(MONTH(<\/span><span style=\"font-weight: 400;\">C21<\/span><span style=\"font-weight: 400;\">), <\/span><span style=\"font-weight: 400;\">1<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">&#8220;JAN&#8221;<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">2<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">&#8220;FEB&#8221;<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">3<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">&#8220;MAR&#8221;<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">4<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">&#8220;APR&#8221;<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">5<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">&#8220;MAY&#8221;<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">6<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">&#8220;JUN&#8221;<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">7<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">&#8220;JUL&#8221;<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">8<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">&#8220;AUG&#8221;<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">9<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">&#8220;SEP&#8221;<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">10<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">&#8220;OCT&#8221;<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">11<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">&#8220;NOV&#8221;<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">12<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">&#8220;DEC&#8221;<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">&#8220;No match&#8221;<\/span><span style=\"font-weight: 400;\">)<\/span><\/p>\n<p>[\/et_pb_text][et_pb_text module_id=&#8221;weekday&#8221; _builder_version=&#8221;4.24.1&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h3><span style=\"font-weight: 400;\">Using <\/span><span style=\"font-weight: 400;\">SWITCH with WEEKDAY<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Similarly to MONTH, the output of WEEKDAY is difficult to read. Not only does it output numbers instead of text, the numbers can be set to correspond to different days.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">This is the basic formula to use if Sunday is considered the first day of the week.<\/span><\/p>\n<p>[\/et_pb_text][et_pb_text module_class=&#8221;spreadsheet-function&#8221; _builder_version=&#8221;4.24.1&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">=SWITCH(WEEKDAY(C21, 1), 1, &#8220;SUN&#8221;, 2, &#8220;MON&#8221;, 3, &#8220;TUE&#8221;, 4, &#8220;WED&#8221;, 5, &#8220;THU&#8221;, 6, &#8220;FRI&#8221;, 7, &#8220;SAT&#8221;, &#8220;No match&#8221;)<\/span><\/p>\n<p>[\/et_pb_text][et_pb_text module_id=&#8221;errortype&#8221; _builder_version=&#8221;4.24.1&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h3><span style=\"font-weight: 400;\">Combining <\/span><span style=\"font-weight: 400;\">SWITCH with ERROR.TYPE<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Another formula that returns cryptic codes is ERROR.TYPE, and SWITCH can replace them with more meaningful messages.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The formula below is just a starting point. It would be a good idea to adapt it to provide hints on how to fix these errors on your spreadsheet.<\/span><\/p>\n<p>[\/et_pb_text][et_pb_text module_class=&#8221;spreadsheet-function&#8221; _builder_version=&#8221;4.24.1&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span style=\"font-weight: 400;\">=IF(ISERROR(C21), SWITCH(ERROR.TYPE(C21), 1, &#8220;Null error&#8221;, 2, &#8220;Division by zero error&#8221;, 3, &#8220;Value error&#8221;, 4, &#8220;Reference error&#8221;, 5, &#8220;Name error&#8221;, 6, &#8220;Number error&#8221;, 7, &#8220;Not available error&#8221;, 8, &#8220;Getting data error&#8221;, 9, &#8220;Spill error&#8221;, 10, &#8220;Calc error&#8221;, &#8220;Unknown error&#8221;), &#8220;No error&#8221;)<\/span><\/p>\n<p>[\/et_pb_text][et_pb_text module_id=&#8221;sheetgo&#8221; _builder_version=&#8221;4.27.2&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h2><span style=\"font-weight: 400;\">Handle your data with Sheetgo<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">SWITCH is a great function, but it can only be used in a handful of cases. Sheetgo provides an arsenal of data processing tools to automate your workflows.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">This platform has the potential to revolutionize your work, automating tedious tasks and sharing insights across your team.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">These are just some of the key Sheetgo features:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Automations<\/b><span style=\"font-weight: 400;\"> &#8211; Link your data sources and schedule transfers to have your information available when you need it.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Data processors <\/b><span style=\"font-weight: 400;\">&#8211; Query, merge and split data to suit your needs. Transfer data and keep its formatting.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Sheetgo Forms<\/b><span style=\"font-weight: 400;\"> &#8211; Create forms in seconds to conduct surveys and retrieve valuable information.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\"><a href=\"https:\/\/www.sheetgo.com\/products\/connect\/\">Try out Sheetgo today<\/a> and start saving precious time.<\/span><\/p>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.24.1&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h2><span style=\"font-weight: 400;\">SWITCH it up!<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">The SWITCH function in Google Sheets is an alternative to nested IF statements.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">By evaluating an expression against a series of cases and returning the corresponding value for the first true case, it simplifies complex logical tests and makes your formulas easier to understand<\/span><\/p>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.22.2&#8243; background_color=&#8221;#f9f9ff&#8221; custom_margin=&#8221;40px||40px||false|false&#8221; custom_padding=&#8221;15px|25px|15px|25px|true|true&#8221; border_width_left=&#8221;3px&#8221; border_color_left=&#8221;#808e95&#8243; saved_tabs=&#8221;all&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><em><strong>Editor\u2019s note<\/strong>: This is a revised version of a previous post that has been updated for accuracy and comprehensiveness.<\/em><\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This Google Sheets SWITCH evaluates an expression against a set of specific cases. The first case to evaluate as TRUE will return a corresponding value. If all cases are FALSE, the formula can return a default value. The function works similarly to nested IF functions. But its syntax is much simpler, making it easy for [&hellip;]<\/p>\n","protected":false},"author":40,"featured_media":29378,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_et_pb_use_builder":"on","_et_pb_old_content":"<p>In Google Sheets, the <a href=\"https:\/\/productforums.google.com\/forum\/#!msg\/docs\/oj3wNGdXRVE\/RnZ_dXl6AQAJ\">SWITCH<\/a> formula's functionality is pretty much similar to that of the nested IF formula constructs. Except, the syntax is simpler. Firstly, it evaluates a logical expression and matches with one of the cases available. Accordingly it returns the value defined in that case block. If there is no matching case, then, it returns the default value. This process is explained in the flow chart diagram below.<\/p>\n<p><img class=\"aligncenter wp-image-2802\" src=\"https:\/\/importsheet.com\/wp-content\/uploads\/2017\/03\/SWITCH-Formula-Illustration-1-1024x1020.png\" alt=\"SWITCH Formula - Illustration 1\" width=\"500\" height=\"498\" \/><\/p>\n<h3>Syntax<\/h3>\n<p><strong><span style=\"font-family: courier new,courier,monospace; font-size: 14pt;\">SWITCH(logical_expression, case1, value1, [case2, value2]..., default)<\/span><\/strong><\/p>\n<p><span style=\"font-family: courier new,courier,monospace; font-size: 12pt;\"><strong>logical_expression<\/strong><\/span> - a value, expression or reference to a cell containing a value or expression that returns a value.<\/p>\n<p><span style=\"font-size: 12pt; font-family: courier new,courier,monospace;\"><strong>case1<\/strong><\/span> - the value with which the SWITCH formula compares the value derived from <span style=\"font-size: 12pt; font-family: courier new,courier,monospace;\"><strong>logical_expression<\/strong><\/span>.<\/p>\n<p><span style=\"font-size: 12pt; font-family: courier new,courier,monospace;\"><strong>value1<\/strong><\/span> - the value that the formula returns as an output if the value derived from the <span style=\"font-size: 12pt; font-family: courier new,courier,monospace;\"><strong>logical_expression<\/strong><\/span> matches with that of the <span style=\"font-family: courier new,courier,monospace; font-size: 12pt;\"><strong>case1<\/strong><\/span>.<\/p>\n<p><span style=\"font-family: courier new,courier,monospace; font-size: 12pt;\"><strong>default<\/strong><\/span> - the formula returns this value as output if none of the cases match with that of the value derived from <span style=\"font-size: 12pt; font-family: courier new,courier,monospace;\"><strong>logical_expression<\/strong><\/span>.<\/p>\n<h3>Usage: SWITCH Formula<\/h3>\n<h5>Example # 1:<\/h5>\n<p>Let us start with the fundamental version of the formula, and understand its working. It is noteworthy that neither the Google Sheets shows any contextual help for SWITCH formula, nor there is any available documentation. Nevertheless, it works just fine.<\/p>\n<p><img class=\"aligncenter size-full wp-image-2807\" src=\"https:\/\/static.sheetgo.com\/wp-content\/uploads\/2017\/11\/switch.png\" alt=\"SWITCH Formula - Illustration 2\" width=\"452\" height=\"115\" \/><\/p>\n<p>In the above example, the expression is just '2'. It is compared with all three of the cases available, and it is matched with the second case. So, accordingly it returns the value 'Bob' in the cell.<\/p>\n<h5>Example # 2:<\/h5>\n<p>What happens when none of the cases match with the expression? Let us experiment.<\/p>\n<p><img class=\"aligncenter size-full wp-image-2808\" src=\"https:\/\/static.sheetgo.com\/wp-content\/uploads\/2017\/11\/switch2-1.png\" alt=\"SWITCH Formula - Illustration 3\" width=\"453\" height=\"136\" \/><\/p>\n<p>The expression '5' matches with none of the available cases, as a result, the formula returns the default value 'None'. What does the formula return when we do not define any default value? It coughs up an error, as shown in the snapshot below.<\/p>\n<p><img class=\"aligncenter size-full wp-image-2809\" src=\"https:\/\/static.sheetgo.com\/wp-content\/uploads\/2017\/11\/switch3-1.png\" alt=\"SWITCH Formula - Illustration 4\" width=\"453\" height=\"159\" \/><\/p>\n<h5>Example # 3:<\/h5>\n<p>Similar to other formulas in Google Sheets, we can also use cell references within the SWITCH formula instead of hard coded values.<\/p>\n<p><img class=\"aligncenter size-full wp-image-2810\" src=\"https:\/\/static.sheetgo.com\/wp-content\/uploads\/2017\/11\/switch4.png\" alt=\"SWITCH Formula - Illustration 5\" width=\"964\" height=\"197\" \/><\/p>\n<p>Learn more about a similar formula IF in the following blog post:\u00a0<strong><a href=\"https:\/\/www.sheetgo.com\/blog\/google-sheets-formulas\/if-formula-google-sheets\/\">How to use the IF Formula in Google Sheets<\/a>.<\/strong><\/p>\n\n<!-- wp:paragraph -->\n<p><\/p>\n<!-- \/wp:paragraph -->","_et_gb_content_width":"","footnotes":""},"categories":[54],"tags":[39,28],"class_list":["post-2777","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-google-sheets-formulas","tag-connections-t","tag-spreadsheets"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.sheetgo.com\/es\/wp-json\/wp\/v2\/posts\/2777","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sheetgo.com\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sheetgo.com\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sheetgo.com\/es\/wp-json\/wp\/v2\/users\/40"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sheetgo.com\/es\/wp-json\/wp\/v2\/comments?post=2777"}],"version-history":[{"count":0,"href":"https:\/\/www.sheetgo.com\/es\/wp-json\/wp\/v2\/posts\/2777\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sheetgo.com\/es\/wp-json\/wp\/v2\/media\/29378"}],"wp:attachment":[{"href":"https:\/\/www.sheetgo.com\/es\/wp-json\/wp\/v2\/media?parent=2777"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sheetgo.com\/es\/wp-json\/wp\/v2\/categories?post=2777"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sheetgo.com\/es\/wp-json\/wp\/v2\/tags?post=2777"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}