How can I create a Formula number field with the 'If, Else' statement?

How can I create a Formula number field with the 'If, Else' statement?

Currently, there is no option to create a Formula number field with the 'If, Else' statement. You can only create a formula field with the IF condition. However, you can achieve the If, Else statement using the If condition.

For example, you want to create a formula number field that returns the following output:

If field name contains 'Yellow', then return 265 ; Else if field name contains 'Red' return 295; Else if field name contains 'Blue' return 665; Else return 0.

Then, you can define the following formula:

If( Contains( $Contacts.fieldname, 'Yellow') , 265, 

If(Contains($Contacts.fieldname,'Red'),295 , 
If(Contains($Contacts.fieldname,'Blue'),665, 0 ) ) )