Ich habe eine funktionierende Lösung. Drücken Sie Alt+ F11, um den Visual Basic-Editor aufzurufen, erstellen Sie ein neues Modul und fügen Sie diesen Code ein. Sie werden in der Lage, die verwenden CAT
Funktion in jeder Zelle wie folgt aus : =CAT(category,qualities)
.
' Function that expects a quality and returns the respective code ' Important: Tick check box beside "Microsoft Scripting Runtime" in Tools > References Function lookup_code(ByRef quality) Dim dict As New Scripting.Dictionary dict.Add "Arboricultural", "1" dict.Add "Landscape", "2" dict.Add "Cultural_and_Conservation", "3" lookup_code = dict(quality) End Function ' Function to output the concatenated CAT code ' Use in any Excel cell as `=CAT(category, qualities)` ' Expects a category (e.g. "A") and a string of one or more qualities, separated by a comma Function CAT(category, qualities) Dim code As String If InStr(qualities, ",") > 0 Then ' Check for commas Dim QualityArray() As String QualityArray = Split(qualities, ",") ' Split string at commas For Each q In QualityArray code = code & "," & lookup_code(q) ' match code to quality Next Else code = "," & lookup_code(CStr(qualities)) End If CAT = category & code ' return category and codes (e.g. "B,2,3,1") End Function