Excel提取中文的首字母 - 图1

    Excel提取中文的首字母 - 图2

    把代码复制进去

    1. Function Getpychar(char)
    2. temp = 65536 + Asc(char)
    3. If (temp >= 45217 And temp <= 45252) Then
    4. Getpychar = "A"
    5. ElseIf (temp >= 45253 And temp <= 45760) Then
    6. Getpychar = "B"
    7. ElseIf (temp >= 45761 And temp <= 46317) Then
    8. Getpychar = "C"
    9. ElseIf (temp >= 46318 And temp <= 46825) Then
    10. Getpychar = "D"
    11. ElseIf (temp >= 46826 And temp <= 47009) Then
    12. Getpychar = "E"
    13. ElseIf (temp >= 47010 And temp <= 47296) Then
    14. Getpychar = "F"
    15. ElseIf (temp >= 47297 And temp <= 47613) Then
    16. Getpychar = "G"
    17. ElseIf (temp >= 47614 And temp <= 48118) Then
    18. Getpychar = "H"
    19. ElseIf (temp >= 48119 And temp <= 49061) Then
    20. Getpychar = "J"
    21. ElseIf (temp >= 49062 And temp <= 49323) Then
    22. Getpychar = "K"
    23. ElseIf (temp >= 49324 And temp <= 49895) Then
    24. Getpychar = "L"
    25. ElseIf (temp >= 49896 And temp <= 50370) Then
    26. Getpychar = "M"
    27. ElseIf (temp >= 50371 And temp <= 50613) Then
    28. Getpychar = "N"
    29. ElseIf (temp >= 50614 And temp <= 50621) Then
    30. Getpychar = "O"
    31. ElseIf (temp >= 50622 And temp <= 50905) Then
    32. Getpychar = "P"
    33. ElseIf (temp >= 50906 And temp <= 51386) Then
    34. Getpychar = "Q"
    35. ElseIf (temp >= 51387 And temp <= 51445) Then
    36. Getpychar = "R"
    37. ElseIf (temp >= 51446 And temp <= 52217) Then
    38. Getpychar = "S"
    39. ElseIf (temp >= 52218 And temp <= 52697) Then
    40. Getpychar = "T"
    41. ElseIf (temp >= 52698 And temp <= 52979) Then
    42. Getpychar = "W"
    43. ElseIf (temp >= 52980 And temp <= 53640) Then
    44. Getpychar = "X"
    45. ElseIf (temp >= 53689 And temp <= 54480) Then
    46. Getpychar = "Y"
    47. ElseIf (temp >= 54481 And temp <= 62289) Then
    48. Getpychar = "Z"
    49. Else
    50. Getpychar = char
    51. End If
    52. End Function
    53. Function Getpy(str)
    54. For a = 1 To Len(str)
    55. Getpy = Getpy & Getpychar(Mid(str, a, 1))
    56. Next a
    57. End Function

    Excel提取中文的首字母 - 图3

    Excel提取中文的首字母 - 图4

    1. =getpy()

    最后回车完成,下拉补全即可