SWITCH Function In Microsoft Excel Google Spreadsheet

So when you doing spreadsheet, you may want to put some logic to manipulate your Excel cells. Switch function can be used if you have a value that match list of values, then return the matched value.

For example if you have some conditions like this example below, if:
1 -> Very bad
2-> Bad
3 -> Normal
4- -> Good
5 -> Very good

You can do that in Excel or Google spreadsheet using Switch function, look at this below example spreadsheet for using switch function.

The syntax of switch function

=SWITCH(Value , Value to match1 , Value to return if there's a match1, ..., Value to return if there's no match at all)

Example using switch

=SWITCH(B1,1,"very bad",2,"bad",3,"normal",4,"good",5,"very good")

To make those function clear for you, you can look at the above real example spreadsheet.

SWITCH function can be used to evaluate some value or an expression against a list of values, that will return the result corresponding to the first matching value.

If there is no match, you can put an optional default value to be returned using the last parameter for example:

=switch(val, 1, "good", "bad").

If the value is 1 will return 'Good' otherwise will return 'Bad'.


Popular posts from this blog

ERROR 1348 Column Password Is Not Updatable When Updating MySQL Root Password

How To Connect SSH Using PEM Certificate On Windows

Which Better WinZip vs WinRAR? Windows Zip and Unzip Tools

How To Create Spring Boot Project Using Netbeans

Spring Kafka - how to use ReplyingKafkaTemplate send and reply synchronously