office交流網--QQ交流群號

Access培訓群:792054000         Excel免費交流群群:686050929          Outlook交流群:221378704    

Word交流群:218156588             PPT交流群:324131555

通用中文轉拚音函數(全拚完整版)適閤Excel與Access VBA,支持是否加空格及首字母是否大寫

2017-09-04 10:15:00
zstmtony
原創
21501

通用中文轉拚音函數(全拚完整版)衕時適閤Excel與Access VBA,支持多種設置選項,如是否加空格及首字母是否大寫

1.生成效果1: wang yu hong

2.生成效果2: wangyuhong

3.生成效果3:WangYuHong


可以根據自己的需要進行不衕的設置,以穫取適閤自己的中文轉拚音格式


'通用中文轉拚音函數(全拚完整版)衕時適閤Excel與Access VBA,支持多種設置選項,如是否加空格及首字母是否大寫
'blnNeedSpace 2箇拚音之間是否要加空格
'blnFirstUpper 拚音首字是否大寫
' tmtony  - Office交流網

Public Function gf_GetPy(str As String, Optional blnNeedSpace As Boolean = True, Optional blnFirstUpper As Boolean = False)
    Dim i As Long
    Dim j As Long
    Dim strTmp As String
    For i = 1 To Len(str)
       strTmp = SimplePinYin(Mid(str, i, 1))
       If blnNeedSpace = False Then strTmp = Trim(strTmp)
       If blnFirstUpper Then
          If Len(strTmp) > 0 Then
            strTmp = UCase(Left(strTmp, 1)) & Mid(strTmp, 2)
          End If
       End If
       gf_GetPy = gf_GetPy & strTmp
    Next i
End Function


'穫取單箇中文漢字的全拚間函數
Private Function SimplePinYin(p As String) As String
Dim i As Long
i = Asc(p)
Select Case i
Case -20319 To -20318: SimplePinYin = "a "
Case -20317 To -20305: SimplePinYin = "ai "
Case -20304 To -20296: SimplePinYin = "an "
Case -20295 To -20293: SimplePinYin = "ang "
Case -20292 To -20284: SimplePinYin = "ao "
Case -20283 To -20266: SimplePinYin = "ba "
Case -20265 To -20258: SimplePinYin = "bai "
Case -20257 To -20243: SimplePinYin = "ban "
Case -20242 To -20231: SimplePinYin = "bang "
Case -20230 To -20052: SimplePinYin = "bao "
Case -20051 To -20037: SimplePinYin = "bei "
Case -20036 To -20033: SimplePinYin = "ben "
Case -20032 To -20027: SimplePinYin = "beng "
Case -20026 To -20003: SimplePinYin = "bi "
Case -20002 To -19991: SimplePinYin = "bian "
Case -19990 To -19987: SimplePinYin = "biao "
Case -19986 To -19983: SimplePinYin = "bie "
Case -19982 To -19977: SimplePinYin = "bin "
Case -19976 To -19806: SimplePinYin = "bing "
Case -19805 To -19785: SimplePinYin = "bo "
Case -19784 To -19776: SimplePinYin = "bu "
Case -19775 To -19775: SimplePinYin = "ca "
Case -19774 To -19764: SimplePinYin = "cai "
Case -19763 To -19757: SimplePinYin = "can "
Case -19756 To -19752: SimplePinYin = "cang "
Case -19751 To -19747: SimplePinYin = "cao "
Case -19746 To -19742: SimplePinYin = "ce "
Case -19741 To -19740: SimplePinYin = "ceng "
Case -19739 To -19729: SimplePinYin = "cha "
Case -19728 To -19726: SimplePinYin = "chai "
Case -19725 To -19716: SimplePinYin = "chan "
Case -19715 To -19541: SimplePinYin = "chang "
Case -19540 To -19532: SimplePinYin = "chao "
Case -19531 To -19526: SimplePinYin = "che "
Case -19525 To -19516: SimplePinYin = "chen "
Case -19515 To -19501: SimplePinYin = "cheng "
Case -19500 To -19485: SimplePinYin = "chi "
Case -19484 To -19480: SimplePinYin = "chong "
Case -19479 To -19468: SimplePinYin = "chou "
Case -19467 To -19290: SimplePinYin = "chu "
Case -19289 To -19289: SimplePinYin = "chuai "
Case -19288 To -19282: SimplePinYin = "chuan "
Case -19281 To -19276: SimplePinYin = "chuang "
Case -19275 To -19271: SimplePinYin = "chui "
Case -19270 To -19264: SimplePinYin = "chun "
Case -19263 To -19262: SimplePinYin = "chuo "
Case -19261 To -19250: SimplePinYin = "ci "
Case -19249 To -19244: SimplePinYin = "cong "
Case -19243 To -19243: SimplePinYin = "cou "
Case -19242 To -19239: SimplePinYin = "cu "
Case -19238 To -19236: SimplePinYin = "cuan "
Case -19235 To -19228: SimplePinYin = "cui "
Case -19227 To -19225: SimplePinYin = "cun "
Case -19224 To -19219: SimplePinYin = "cuo "
Case -19218 To -19213: SimplePinYin = "da "
Case -19212 To -19039: SimplePinYin = "dai "
Case -19038 To -19024: SimplePinYin = "dan "
Case -19023 To -19019: SimplePinYin = "dang "
Case -19018 To -19007: SimplePinYin = "dao "
Case -19006 To -19004: SimplePinYin = "de "
Case -19003 To -18997: SimplePinYin = "deng "
Case -18996 To -18978: SimplePinYin = "di "
Case -18977 To -18962: SimplePinYin = "dian "
Case -18961 To -18953: SimplePinYin = "diao "
Case -18952 To -18784: SimplePinYin = "die "
Case -18783 To -18775: SimplePinYin = "ding "
Case -18774 To -18774: SimplePinYin = "diu "
Case -18773 To -18527: SimplePinYin = "dong "
Case -18526 To -18519: SimplePinYin = "fa "
Case -18518 To -18502: SimplePinYin = "fan "
Case -18501 To -18491: SimplePinYin = "fang "
Case -18490 To -18479: SimplePinYin = "fei "
Case -18478 To -18464: SimplePinYin = "fen "
Case -18463 To -18449: SimplePinYin = "feng "
Case -18448 To -18448: SimplePinYin = "fo "
Case -18447 To -18447: SimplePinYin = "fou "
Case -18446 To -18240: SimplePinYin = "fu "
Case -18239 To -18238: SimplePinYin = "ga "
Case -18237 To -18232: SimplePinYin = "gai "
Case -18231 To -18221: SimplePinYin = "gan "
Case -18220 To -18212: SimplePinYin = "gang "
Case -18211 To -18202: SimplePinYin = "gao "
Case -18201 To -18185: SimplePinYin = "ge "
Case -18184 To -18184: SimplePinYin = "gei "
Case -18183 To -18182: SimplePinYin = "gen "
Case -18181 To -18013: SimplePinYin = "geng "
Case -18012 To -17998: SimplePinYin = "gong "
Case -17997 To -17989: SimplePinYin = "gou "
Case -17988 To -17971: SimplePinYin = "gu "
Case -17970 To -17965: SimplePinYin = "gua "
Case -17964 To -17962: SimplePinYin = "guai "
Case -17961 To -17951: SimplePinYin = "guan "
Case -17950 To -17948: SimplePinYin = "guang "
Case -17947 To -17932: SimplePinYin = "gui "
Case -17931 To -17929: SimplePinYin = "gun "
Case -17928 To -17923: SimplePinYin = "guo "
Case -17922 To -17760: SimplePinYin = "ha "
Case -17759 To -17753: SimplePinYin = "hai "
Case -17752 To -17734: SimplePinYin = "han "
Case -17733 To -17731: SimplePinYin = "hang "
Case -17730 To -17722: SimplePinYin = "hao "
Case -17721 To -17704: SimplePinYin = "he "
Case -17703 To -17702: SimplePinYin = "hei "
Case -17701 To -17698: SimplePinYin = "hen "
Case -17697 To -17693: SimplePinYin = "heng "
Case -17692 To -17684: SimplePinYin = "hong "
Case -17683 To -17677: SimplePinYin = "hou "
Case -17676 To -17497: SimplePinYin = "hu "
Case -17496 To -17488: SimplePinYin = "hua "
Case -17487 To -17483: SimplePinYin = "huai "
Case -17482 To -17469: SimplePinYin = "huan "
Case -17468 To -17455: SimplePinYin = "huang "
Case -17454 To -17434: SimplePinYin = "hui "
Case -17433 To -17428: SimplePinYin = "hun "
Case -17427 To -17418: SimplePinYin = "huo "
Case -17417 To -17203: SimplePinYin = "ji "
Case -17202 To -17186: SimplePinYin = "jia "
Case -17185 To -16984: SimplePinYin = "jian "
Case -16983 To -16971: SimplePinYin = "jiang "
Case -16970 To -16943: SimplePinYin = "jiao "
Case -16942 To -16916: SimplePinYin = "jie "
Case -16915 To -16734: SimplePinYin = "jin "
Case -16733 To -16709: SimplePinYin = "jing "
Case -16708 To -16707: SimplePinYin = "jiong "
Case -16706 To -16690: SimplePinYin = "jiu "
Case -16689 To -16665: SimplePinYin = "ju "
Case -16664 To -16658: SimplePinYin = "juan "
Case -16657 To -16648: SimplePinYin = "jue "
Case -16647 To -16475: SimplePinYin = "jun "
Case -16474 To -16471: SimplePinYin = "ka "
Case -16470 To -16466: SimplePinYin = "kai "
Case -16465 To -16460: SimplePinYin = "kan "
Case -16459 To -16453: SimplePinYin = "kang "
Case -16452 To -16449: SimplePinYin = "kao "
Case -16448 To -16434: SimplePinYin = "ke "
Case -16433 To -16430: SimplePinYin = "ken "
Case -16429 To -16428: SimplePinYin = "keng "
Case -16427 To -16424: SimplePinYin = "kong "
Case -16423 To -16420: SimplePinYin = "kou "
Case -16419 To -16413: SimplePinYin = "ku "
Case -16412 To -16408: SimplePinYin = "kua "
Case -16407 To -16404: SimplePinYin = "kuai "
Case -16403 To -16402: SimplePinYin = "kuan "
Case -16401 To -16394: SimplePinYin = "kuang "
Case -16393 To -16221: SimplePinYin = "kui "
Case -16220 To -16217: SimplePinYin = "kun "
Case -16216 To -16213: SimplePinYin = "kuo "
Case -16212 To -16206: SimplePinYin = "la "
Case -16205 To -16203: SimplePinYin = "lai "
Case -16202 To -16188: SimplePinYin = "lan "
Case -16187 To -16181: SimplePinYin = "lang "
Case -16180 To -16172: SimplePinYin = "lao "
Case -16171 To -16170: SimplePinYin = "le "
Case -16169 To -16159: SimplePinYin = "lei "
Case -16158 To -16156: SimplePinYin = "leng "
Case -16155 To -15960: SimplePinYin = "li "
Case -15959 To -15959: SimplePinYin = "lia "
Case -15958 To -15945: SimplePinYin = "lian "
Case -15944 To -15934: SimplePinYin = "liang "
Case -15933 To -15921: SimplePinYin = "liao "
Case -15920 To -15916: SimplePinYin = "lie "
Case -15915 To -15904: SimplePinYin = "lin "
Case -15903 To -15890: SimplePinYin = "ling "
Case -15889 To -15879: SimplePinYin = "liu "
Case -15878 To -15708: SimplePinYin = "long "
Case -15707 To -15702: SimplePinYin = "lou "
Case -15701 To -15682: SimplePinYin = "lu "
Case -15681 To -15668: SimplePinYin = "lv "
Case -15667 To -15662: SimplePinYin = "luan "
Case -15661 To -15660: SimplePinYin = "lue "
Case -15659 To -15653: SimplePinYin = "lun "
Case -15652 To -15641: SimplePinYin = "luo "
Case -15640 To -15632: SimplePinYin = "ma "
Case -15631 To -15626: SimplePinYin = "mai "
Case -15625 To -15455: SimplePinYin = "man "
Case -15454 To -15449: SimplePinYin = "mang "
Case -15448 To -15437: SimplePinYin = "mao "
Case -15436 To -15436: SimplePinYin = "me "
Case -15435 To -15420: SimplePinYin = "mei "
Case -15419 To -15417: SimplePinYin = "men "
Case -15416 To -15409: SimplePinYin = "meng "
Case -15408 To -15395: SimplePinYin = "mi "
Case -15394 To -15386: SimplePinYin = "mian "
Case -15385 To -15378: SimplePinYin = "miao "
Case -15377 To -15376: SimplePinYin = "mie "
Case -15375 To -15370: SimplePinYin = "min "
Case -15369 To -15364: SimplePinYin = "ming "
Case -15363 To -15363: SimplePinYin = "miu "
Case -15362 To -15184: SimplePinYin = "mo "
Case -15183 To -15181: SimplePinYin = "mou "
Case -15180 To -15166: SimplePinYin = "mu "
Case -15165 To -15159: SimplePinYin = "na "
Case -15158 To -15154: SimplePinYin = "nai "
Case -15153 To -15151: SimplePinYin = "nan "
Case -15150 To -15150: SimplePinYin = "nang "
Case -15149 To -15145: SimplePinYin = "nao "
Case -15144 To -15144: SimplePinYin = "ne "
Case -15143 To -15142: SimplePinYin = "nei "
Case -15141 To -15141: SimplePinYin = "nen "
Case -15140 To -15140: SimplePinYin = "neng "
Case -15139 To -15129: SimplePinYin = "ni "
Case -15128 To -15122: SimplePinYin = "nian "
Case -15121 To -15120: SimplePinYin = "niang "
Case -15119 To -15118: SimplePinYin = "niao "
Case -15117 To -15111: SimplePinYin = "nie "
Case -15110 To -15110: SimplePinYin = "nin "
Case -15109 To -14942: SimplePinYin = "ning "
Case -14941 To -14938: SimplePinYin = "niu "
Case -14937 To -14934: SimplePinYin = "nong "
Case -14933 To -14931: SimplePinYin = "nu "
Case -14930 To -14930: SimplePinYin = "nv "
Case -14929 To -14929: SimplePinYin = "nuan "
Case -14928 To -14927: SimplePinYin = "nue "
Case -14926 To -14923: SimplePinYin = "nuo "
Case -14922 To -14922: SimplePinYin = "o "
Case -14921 To -14915: SimplePinYin = "ou "
Case -14914 To -14909: SimplePinYin = "pa "
Case -14908 To -14903: SimplePinYin = "pai "
Case -14902 To -14895: SimplePinYin = "pan "
Case -14894 To -14890: SimplePinYin = "pang "
Case -14889 To -14883: SimplePinYin = "pao "
Case -14882 To -14874: SimplePinYin = "pei "
Case -14873 To -14872: SimplePinYin = "pen "
Case -14871 To -14858: SimplePinYin = "peng "
Case -14857 To -14679: SimplePinYin = "pi "
Case -14678 To -14675: SimplePinYin = "pian "
Case -14674 To -14671: SimplePinYin = "piao "
Case -14670 To -14669: SimplePinYin = "pie "
Case -14668 To -14664: SimplePinYin = "pin "
Case -14663 To -14655: SimplePinYin = "ping "
Case -14654 To -14646: SimplePinYin = "po "
Case -14645 To -14631: SimplePinYin = "pu "
Case -14630 To -14595: SimplePinYin = "qi "
Case -14594 To -14430: SimplePinYin = "qia "
Case -14429 To -14408: SimplePinYin = "qian "
Case -14407 To -14400: SimplePinYin = "qiang "
Case -14399 To -14385: SimplePinYin = "qiao "
Case -14384 To -14380: SimplePinYin = "qie "
Case -14379 To -14369: SimplePinYin = "qin "
Case -14368 To -14356: SimplePinYin = "qing "
Case -14355 To -14354: SimplePinYin = "qiong "
Case -14353 To -14346: SimplePinYin = "qiu "
Case -14345 To -14171: SimplePinYin = "qu "
Case -14170 To -14160: SimplePinYin = "quan "
Case -14159 To -14152: SimplePinYin = "que "
Case -14151 To -14150: SimplePinYin = "qun "
Case -14149 To -14146: SimplePinYin = "ran "
Case -14145 To -14141: SimplePinYin = "rang "
Case -14140 To -14138: SimplePinYin = "rao "
Case -14137 To -14136: SimplePinYin = "re "
Case -14135 To -14126: SimplePinYin = "ren "
Case -14125 To -14124: SimplePinYin = "reng "
Case -14123 To -14123: SimplePinYin = "ri "
Case -14122 To -14113: SimplePinYin = "rong "
Case -14112 To -14110: SimplePinYin = "rou "
Case -14109 To -14100: SimplePinYin = "ru "
Case -14099 To -14098: SimplePinYin = "ruan "
Case -14097 To -14095: SimplePinYin = "rui "
Case -14094 To -14093: SimplePinYin = "run "
Case -14092 To -14091: SimplePinYin = "ruo "
Case -14090 To -14088: SimplePinYin = "sa "
Case -14087 To -14084: SimplePinYin = "sai "
Case -14083 To -13918: SimplePinYin = "san "
Case -13917 To -13915: SimplePinYin = "sang "
Case -13914 To -13911: SimplePinYin = "sao "
Case -13910 To -13908: SimplePinYin = "se "
Case -13907 To -13907: SimplePinYin = "sen "
Case -13906 To -13906: SimplePinYin = "seng "
Case -13905 To -13897: SimplePinYin = "sha "
Case -13896 To -13895: SimplePinYin = "shai "
Case -13894 To -13879: SimplePinYin = "shan "
Case -13878 To -13871: SimplePinYin = "shang "
Case -13870 To -13860: SimplePinYin = "shao "
Case -13859 To -13848: SimplePinYin = "she "
Case -13847 To -13832: SimplePinYin = "shen "
Case -13831 To -13659: SimplePinYin = "sheng "
Case -13658 To -13612: SimplePinYin = "shi "
Case -13611 To -13602: SimplePinYin = "shou "
Case -13601 To -13407: SimplePinYin = "shu "
Case -13406 To -13405: SimplePinYin = "shua "
Case -13404 To -13401: SimplePinYin = "shuai "
Case -13400 To -13399: SimplePinYin = "shuan "
Case -13398 To -13396: SimplePinYin = "shuang "
Case -13395 To -13392: SimplePinYin = "shui "
Case -13391 To -13388: SimplePinYin = "shun "
Case -13387 To -13384: SimplePinYin = "shuo "
Case -13383 To -13368: SimplePinYin = "si "
Case -13367 To -13360: SimplePinYin = "song "
Case -13359 To -13357: SimplePinYin = "sou "
Case -13356 To -13344: SimplePinYin = "su "
Case -13343 To -13341: SimplePinYin = "suan "
Case -13340 To -13330: SimplePinYin = "sui "
Case -13329 To -13327: SimplePinYin = "sun "
Case -13326 To -13319: SimplePinYin = "suo "
Case -13318 To -13148: SimplePinYin = "ta "
Case -13147 To -13139: SimplePinYin = "tai "
Case -13138 To -13121: SimplePinYin = "tan "
Case -13120 To -13108: SimplePinYin = "tang "
Case -13107 To -13097: SimplePinYin = "tao "
Case -13096 To -13096: SimplePinYin = "te "
Case -13095 To -13092: SimplePinYin = "teng "
Case -13091 To -13077: SimplePinYin = "ti "
Case -13076 To -13069: SimplePinYin = "tian "
Case -13068 To -13064: SimplePinYin = "tiao "
Case -13063 To -13061: SimplePinYin = "tie "
Case -13060 To -12889: SimplePinYin = "ting "
Case -12888 To -12876: SimplePinYin = "tong "
Case -12875 To -12872: SimplePinYin = "tou "
Case -12871 To -12861: SimplePinYin = "tu "
Case -12860 To -12859: SimplePinYin = "tuan "
Case -12858 To -12853: SimplePinYin = "tui "
Case -12852 To -12850: SimplePinYin = "tun "
Case -12849 To -12839: SimplePinYin = "tuo "
Case -12838 To -12832: SimplePinYin = "wa "
Case -12831 To -12830: SimplePinYin = "wai "
Case -12829 To -12813: SimplePinYin = "wan "
Case -12812 To -12803: SimplePinYin = "wang "
Case -12802 To -12608: SimplePinYin = "wei "
Case -12607 To -12598: SimplePinYin = "wen "
Case -12597 To -12595: SimplePinYin = "weng "
Case -12594 To -12586: SimplePinYin = "wo "
Case -12585 To -12557: SimplePinYin = "wu "
Case -12556 To -12360: SimplePinYin = "xi "
Case -12359 To -12347: SimplePinYin = "xia "
Case -12346 To -12321: SimplePinYin = "xian "
Case -12320 To -12301: SimplePinYin = "xiang "
Case -12300 To -12121: SimplePinYin = "xiao "
Case -12120 To -12100: SimplePinYin = "xie "
Case -12099 To -12090: SimplePinYin = "xin "
Case -12089 To -12075: SimplePinYin = "xing "
Case -12074 To -12068: SimplePinYin = "xiong "
Case -12067 To -12059: SimplePinYin = "xiu "
Case -12058 To -12040: SimplePinYin = "xu "
Case -12039 To -11868: SimplePinYin = "xuan "
Case -11867 To -11862: SimplePinYin = "xue "
Case -11861 To -11848: SimplePinYin = "xun "
Case -11847 To -11832: SimplePinYin = "ya "
Case -11831 To -11799: SimplePinYin = "yan "
Case -11798 To -11782: SimplePinYin = "yang "
Case -11781 To -11605: SimplePinYin = "yao "
Case -11604 To -11590: SimplePinYin = "ye "
Case -11589 To -11537: SimplePinYin = "yi "
Case -11536 To -11359: SimplePinYin = "yin "
Case -11358 To -11341: SimplePinYin = "ying "
Case -11340 To -11340: SimplePinYin = "yo "
Case -11339 To -11325: SimplePinYin = "yong "
Case -11324 To -11304: SimplePinYin = "you "
Case -11303 To -11098: SimplePinYin = "yu "
Case -11097 To -11078: SimplePinYin = "yuan "
Case -11077 To -11068: SimplePinYin = "yue "
Case -11067 To -11056: SimplePinYin = "yun "
Case -11055 To -11053: SimplePinYin = "za "
Case -11052 To -11046: SimplePinYin = "zai "
Case -11045 To -11042: SimplePinYin = "zan "
Case -11041 To -11039: SimplePinYin = "zang "
Case -11038 To -11025: SimplePinYin = "zao "
Case -11024 To -11021: SimplePinYin = "ze "
Case -11020 To -11020: SimplePinYin = "zei "
Case -11019 To -11019: SimplePinYin = "zen "
Case -11018 To -11015: SimplePinYin = "zeng "
Case -11014 To -10839: SimplePinYin = "zha "
Case -10838 To -10833: SimplePinYin = "zhai "
Case -10832 To -10816: SimplePinYin = "zhan "
Case -10815 To -10801: SimplePinYin = "zhang "
Case -10800 To -10791: SimplePinYin = "zhao "
Case -10790 To -10781: SimplePinYin = "zhe "
Case -10780 To -10765: SimplePinYin = "zhen "
Case -10764 To -10588: SimplePinYin = "zheng "
Case -10587 To -10545: SimplePinYin = "zhi "
Case -10544 To -10534: SimplePinYin = "zhong "
Case -10533 To -10520: SimplePinYin = "zhou "
Case -10519 To -10332: SimplePinYin = "zhu "
Case -10331 To -10330: SimplePinYin = "zhua "
Case -10329 To -10329: SimplePinYin = "zhuai "
Case -10328 To -10323: SimplePinYin = "zhuan "
Case -10322 To -10316: SimplePinYin = "zhuang "
Case -10315 To -10310: SimplePinYin = "zhui "
Case -10309 To -10308: SimplePinYin = "zhun "
Case -10307 To -10297: SimplePinYin = "zhuo "
Case -10296 To -10282: SimplePinYin = "zi "
Case -10281 To -10275: SimplePinYin = "zong "
Case -10274 To -10271: SimplePinYin = "zou "
Case -10270 To -10263: SimplePinYin = "zu "
Case -10262 To -10261: SimplePinYin = "zuan "
Case -10260 To -10257: SimplePinYin = "zui "
Case -10256 To -10255: SimplePinYin = "zun "
Case -10254 To -10254: SimplePinYin = "zuo "
Case Else: SimplePinYin = p
End Select
End Function 


如果是用Excel,可以使用Excel自身帶的函數: Excel函數LOOKUP


輸入如下函數"=LOOKUP()",則會提取前四箇字首字母時的函數

=LOOKUP(CODE(A2),45217+{0,36,544,1101,1609,1793,2080,2560,2902,3845,4107,4679,5154,5397,5405,5689,6170,6229,7001,7481,7763,8472,9264},{"A","B","C","D","E","F","G","H","J","K","L","M","N","O","P","Q","R","S","T","W","X","Y","Z"})&LOOKUP(CODE(MID(A2,2,1)),45217+{0,36,544,1101,1609,1793,2080,2560,2902,3845,4107,4679,5154,5397,5405,5689,6170,6229,7001,7481,7763,8472,9264},{"A","B","C","D","E","F","G","H","J","K","L","M","N","O","P","Q","R","S","T","W","X","Y","Z"})&LOOKUP(CODE(MID(A2,3,1)),45217+{0,36,544,1101,1609,1793,2080,2560,2902,3845,4107,4679,5154,5397,5405,5689,6170,6229,7001,7481,7763,8472,9264},{"A","B","C","D","E","F","G","H","J","K","L","M","N","O","P","Q","R","S","T","W","X","Y","Z"})&LOOKUP(CODE(MID(A2,4,1)),45217+{0,36,544,1101,1609,1793,2080,2560,2902,3845,4107,4679,5154,5397,5405,5689,6170,6229,7001,7481,7763,8472,9264},{"A","B","C","D","E","F","G","H","J","K","L","M","N","O","P","Q","R","S","T","W","X","Y","Z"})

提取前二箇字首字母時的函數

=LOOKUP(CODE(A2),45217+{0,36,544,1101,1609,1793,2080,2560,2902,3845,4107,4679,5154,5397,5405,5689,6170,6229,7001,7481,7763,8472,9264},{"A","B","C","D","E","F","G","H","J","K","L","M","N","O","P","Q","R","S","T","W","X","Y","Z"})&LOOKUP(CODE(MID(A2,2,1)),45217+{0,36,544,1101,1609,1793,2080,2560,2902,3845,4107,4679,5154,5397,5405,5689,6170,6229,7001,7481,7763,8472,9264},{"A","B","C","D","E","F","G","H","J","K","L","M","N","O","P","Q","R","S","T","W","X","Y","Z"})

分享