1樓:閒雲
這是將姓名轉為首寫字母:
2樓:格輔圖攻
需要自定義的
給你一段**:
但是效果不好,有些複雜的漢字得到的結果不對
function getpychar(char)
tmp = 65536 + asc(char)
if (tmp >= 45217 and tmp <= 45252) then
getpychar = "a"
elseif (tmp >= 45253 and tmp <= 45760) then
getpychar = "b"
elseif (tmp >= 45761 and tmp <= 46317) then
getpychar = "c"
elseif (tmp >= 46318 and tmp <= 46825) then
getpychar = "d"
elseif (tmp >= 46826 and tmp <= 47009) then
getpychar = "e"
elseif (tmp >= 47010 and tmp <= 47296) then
getpychar = "f"
elseif (tmp >= 47297 and tmp <= 47613) then
getpychar = "g"
elseif (tmp >= 47614 and tmp <= 48118) then
getpychar = "h"
elseif (tmp >= 48119 and tmp <= 49061) then
getpychar = "j"
elseif (tmp >= 49062 and tmp <= 49323) then
getpychar = "k"
elseif (tmp >= 49324 and tmp <= 49895) then
getpychar = "l"
elseif (tmp >= 49896 and tmp <= 50370) then
getpychar = "m"
elseif (tmp >= 50371 and tmp <= 50613) then
getpychar = "n"
elseif (tmp >= 50614 and tmp <= 50621) then
getpychar = "o"
elseif (tmp >= 50622 and tmp <= 50905) then
getpychar = "p"
elseif (tmp >= 50906 and tmp <= 51386) then
getpychar = "q"
elseif (tmp >= 51387 and tmp <= 51445) then
getpychar = "r"
elseif (tmp >= 51446 and tmp <= 52217) then
getpychar = "s"
elseif (tmp >= 52218 and tmp <= 52697) then
getpychar = "t"
elseif (tmp >= 52698 and tmp <= 52979) then
getpychar = "w"
elseif (tmp >= 52980 and tmp <= 53640) then
getpychar = "x"
elseif (tmp >= 53689 and tmp <= 54480) then
getpychar = "y"
elseif (tmp >= 54481 and tmp <= 62289) then
getpychar = "z"
else '如果不是中文,則不處理
getpychar = char
end if
end function
function getpy(str)
for i = 1 to len(str)
getpy = getpy & getpychar(mid(str, i, 1))
next i
end function
3樓:低調一回
開啟excel->工具->巨集->viaual basic編輯器
在彈出來的視窗中對著vbaproject點右鍵->插入->模組
下面會出現一個名為"模組1",點選在右邊的空白欄中貼上以下內容:
function getpychar(char)
tmp = 65536 + asc(char)
if (tmp >= 45217 and tmp <= 45252) then
getpychar = "a"
elseif (tmp >= 45253 and tmp <= 45760) then
getpychar = "b"
elseif (tmp >= 45761 and tmp <= 46317) then
getpychar = "c"
elseif (tmp >= 46318 and tmp <= 46825) then
getpychar = "d"
elseif (tmp >= 46826 and tmp <= 47009) then
getpychar = "e"
elseif (tmp >= 47010 and tmp <= 47296) then
getpychar = "f"
elseif (tmp >= 47297 and tmp <= 47613) then
getpychar = "g"
elseif (tmp >= 47614 and tmp <= 48118) then
getpychar = "h"
elseif (tmp >= 48119 and tmp <= 49061) then
getpychar = "j"
elseif (tmp >= 49062 and tmp <= 49323) then
getpychar = "k"
elseif (tmp >= 49324 and tmp <= 49895) then
getpychar = "l"
elseif (tmp >= 49896 and tmp <= 50370) then
getpychar = "m"
elseif (tmp >= 50371 and tmp <= 50613) then
getpychar = "n"
elseif (tmp >= 50614 and tmp <= 50621) then
getpychar = "o"
elseif (tmp >= 50622 and tmp <= 50905) then
getpychar = "p"
elseif (tmp >= 50906 and tmp <= 51386) then
getpychar = "q"
elseif (tmp >= 51387 and tmp <= 51445) then
getpychar = "r"
elseif (tmp >= 51446 and tmp <= 52217) then
getpychar = "s"
elseif (tmp >= 52218 and tmp <= 52697) then
getpychar = "t"
elseif (tmp >= 52698 and tmp <= 52979) then
getpychar = "w"
elseif (tmp >= 52980 and tmp <= 53640) then
getpychar = "x"
elseif (tmp >= 53689 and tmp <= 54480) then
getpychar = "y"
elseif (tmp >= 54481 and tmp <= 62289) then
getpychar = "z"
else '如果不是中文,則不處理
getpychar = char
end if
end function
function getpy(str)
for i = 1 to len(str)
getpy = getpy & getpychar(mid(str, i, 1))
next i
end function
現在轉換函式已編寫完成!關掉此編緝的視窗。
要在excel中使用,方法如下:
a1中入中文 a2=getpy(a1)就ok了
關於excel中,如何將中文字轉換成拼音首字母的問題
4樓:匿名使用者
5樓:匿名使用者
我也不是很懂,但是在excelhome裡面找到一個你可以自己看看
如何應用excel函式把漢字換成拼音首字母
6樓:
根據gb2312-1980 資訊交換用漢字編碼字符集 漢字分為一級漢字(3755個)和二級漢字(3008)個,一級漢字使用拼音排序,二級漢字使用筆畫排序。因此對於一級漢字比較好辦,找到每個拼音開始和結束的漢字內碼即可。
對於二級漢字還沒有好的辦法,不過一級漢字3755個基本上已經夠用了。目前網上的方法都是針對一級漢字的。
以下使用vba製作一個自定義函式:getpy在**中直接使用這個函式即可。
function getpychar(char)
tmp = 65536 + asc(char)
if (tmp >= 45217 and tmp <= 45252) then
getpychar = "a"
elseif (tmp >= 45253 and tmp <= 45760) then
getpychar = "b"
elseif (tmp >= 45761 and tmp <= 46317) then
getpychar = "c"
elseif (tmp >= 46318 and tmp <= 46825) then
getpychar = "d"
elseif (tmp >= 46826 and tmp <= 47009) then
getpychar = "e"
elseif (tmp >= 47010 and tmp <= 47296) then
getpychar = "f"
elseif (tmp >= 47297 and tmp <= 47613) then
getpychar = "g"
elseif (tmp >= 47614 and tmp <= 48118) then
getpychar = "h"
elseif (tmp >= 48119 and tmp <= 49061) then
getpychar = "j"
elseif (tmp >= 49062 and tmp <= 49323) then
getpychar = "k"
elseif (tmp >= 49324 and tmp <= 49895) then
getpychar = "l"
elseif (tmp >= 49896 and tmp <= 50370) then
getpychar = "m"
elseif (tmp >= 50371 and tmp <= 50613) then
getpychar = "n"
elseif (tmp >= 50614 and tmp <= 50621) then
getpychar = "o"
elseif (tmp >= 50622 and tmp <= 50905) then
getpychar = "p"
elseif (tmp >= 50906 and tmp <= 51386) then
getpychar = "q"
elseif (tmp >= 51387 and tmp <= 51445) then
getpychar = "r"
elseif (tmp >= 51446 and tmp <= 52217) then
getpychar = "s"
elseif (tmp >= 52218 and tmp <= 52697) then
getpychar = "t"
elseif (tmp >= 52698 and tmp <= 52979) then
getpychar = "w"
elseif (tmp >= 52980 and tmp <= 53640) then
getpychar = "x"
elseif (tmp >= 53689 and tmp <= 54480) then
getpychar = "y"
elseif (tmp >= 54481 and tmp <= 62289) then
getpychar = "z"
else '如果不是中文,則不處理
getpychar = char
end if
end function
function getpy(str)
for i = 1 to len(str)
getpy = getpy & getpychar(mid(str, i, 1))
next i
end function
應用舉例:在單元格中輸入公式=getpy(單元格名)即可,如下圖所示,函式的侷限性也在圖中進行了演示。
在excel中如何用irr函式(請具體資料解釋)
1 values為陣列或單元格的引用,包含用來計算返回的內部收益率的數字。values包含至少一個正值和一個負值,以計算返回的內部收益率。函式irr根據數值的順序來解釋現金流的順序。故應確定按需要的順序輸入了支付和收入的數值。excel使用迭代法計算函式irr。從guess開始,函式irr進行迴圈計...
excel單元格中,如何用函式將數字轉化成日期
要求資料必須要有一定的條件 例如長度 這樣規範的資料方便轉換 假設數字在a1單元格,都是20100101 20001222這樣8位長,即轉換過來是年年年年 月月 日日這樣的格式。1 使用text函式 text text a1,0 00 00 yyyy mm dd 或者 text a1,0 00 00...
在Excel中,如何用公式或函式實現把中文數字和阿拉伯數字一律自動轉化為阿拉伯數字?如 A列
index row 1 600 match text a1,dbnum1 text row 1 600 dbnum1 陣列公式 輸入上公式同時按shift ctrl enter結束 最大到600,如果有更大的數,更改下600就可以 match substitute c2,零 text row 1 3...