The latest version of Numbers allows you to use regular expressions, also called regex, in formulas. Regex is very powerful if you can master it. You can use them to match patterns in text to perform otherwise difficult or impossible things in your spreadsheets.
If you have a list of names in Numbers it is very difficult to sort by last name unless you have the last name in a separate column. However, you can use a series of formulas to extract the last name and first name, format them properly as Last, First, and then sort them. It will take some extra effort to deal with middle names and initials as well. You can even get rare last names that include spaces to sort properly.
The IF function is how to test values in spreadsheets. You can use it to simply test a value and show different results. But the key to making complex spreadsheets to learning more about the IF function. You can pass through values when a condition is met, combine conditions with AND and OR functions, and nest IF functions for more than two possible results.