Flash Fill recognizes a pattern from examples you type beside a source list. Enter the first output, then a second example that confirms the pattern. Select the next output cell and choose Data > Flash Fill, or press Ctrl+E on Windows.
The result is plain text or numbers. It won't update if someone changes the source later, so use a formula when the relationship must stay live. Check names with different word counts and codes with different lengths. Two examples that happen to share a prefix can suggest the wrong rule. A second example with a different shape gives Excel more evidence. Flash Fill can also join pieces or change their case. It doesn't prove that the pattern matches your business rule.