正規表現などが必要です。次のパターンの一連の文字列があります。
S 8010-Y30R
7020-R
S 7020-R
3852-R10B
これらを注文する必要があります:
By the last letter in the order: Y R B G
Then by the last two digits
Then by the second last letter (if any) in the order: Y R B G
Then by the two digits
Then by the first two digits
したがって、例:S 8010-Y30R would be ordered by: R 30 Y 10 80
2番目の例:7020-R is a short version of: S 7020-R _ _ _
これらをExcelで注文するか、JavaScriptを使用して2つの配列を並べ替えることができます(1つは上記のカラーコードを含み、もう1つは同じRGBバージョンを含みます)。