EXCEL 公式運算

2015-05-27 3:43 am
A1=IF(H2="男","Mr ",IF(H2="女","Ms ","")(H行為「性別」)
A2=H2
B2=CHAN TAI MAN
H1=性別
H2=男
在D2儲存格「郵遞收件人」公式相應修改為:
=SUBSTITUTE(IF(LEN(TRIM(A2))>0,PROPER(TRIM(A2))&" ","")&UPPER(LEFT(B2,FIND(" ", B2)))&PROPER(MID(B2,FIND(" ", B2)+1,IF(ISNUMBER(FIND(" ", B2,FIND(" ", B2)+1)),FIND(" ", B2,FIND(" ", B2)+1)-FIND(" ", B2)-1,LEN(B2)-FIND(" ", B2))))&IF(LEN(B2)-LEN(SUBSTITUTE(B2," ",""))>=2,"-"&LOWER(RIGHT(B2,LEN(B2)-FIND(" ", B2,FIND(" ", B2)+1))),""),LOWER(RIGHT(B2,LEN(B2)-FIND(",",B2)+1)),PROPER(RIGHT(B2,LEN(B2)-FIND(",",B2)+1)))

A1=公式出現並表示公式左右括號沒有配合,請檢查函數。怎樣解決?
D2=#VALUE!,怎樣解決?
如我做錯了上述步驟,請指正。謝!

回答 (1)

2015-05-27 4:16 am
✔ 最佳答案
A1應該放入欄位標籤「頭銜」(Title),A2公式為「=IF(H2="男","Mr",IF(H2="女","Ms",""))」
在D2儲存格「郵遞收件人」公式在沒有逗號時不能操作,所以修改為:
=SUBSTITUTE(IF(LEN(TRIM(A2))>0,PROPER(TRIM(A2))&" ","")&UPPER(LEFT(B2,FIND(" ", B2)))&PROPER(MID(B2,FIND(" ", B2)+1,IF(ISNUMBER(FIND(" ", B2,FIND(" ", B2)+1)),FIND(" ", B2,FIND(" ", B2)+1)-FIND(" ", B2)-1,LEN(B2)-FIND(" ", B2))))&IF(LEN(B2)-LEN(SUBSTITUTE(B2," ",""))>=2,"-"&LOWER(RIGHT(B2,LEN(B2)-FIND(" ", B2,FIND(" ", B2)+1))),""),LOWER(RIGHT(B2,LEN(B2)-IF(ISNUMBER(FIND(",",B2)),FIND(",",B2)+1,LEN(B2)))),PROPER(RIGHT(B2,LEN(B2)- IF(ISNUMBER(FIND(",",B2)),FIND(",",B2)+1,LEN(B2)))))

至於郵遞收件人是中文姓名要加「先生」或「小姐」,是否放在「頭銜」同一行上嗎(即是男士名是中文用「先生」,是英文用「Mr」)?

2015-05-27 16:19:22 補充:
可將A2公式修改為:
=IF(CODE(LEFT(B2,1))>255,IF(H2="男","先生",IF(H2="女","小姐","")),IF(H2="男","Mr",IF(H2="女","Ms","")))

2015-05-27 16:20:46 補充:
在「郵遞收件人」D2儲存格公式相應修改為:
=IF(CODE(LEFT(A2,1))<256,IF(LEN(TRIM(A2))>0,PROPER(TRIM(A2))&" ","")&SUBSTITUTE(UPPER(LEFT(B2,FIND(" ", B2)))&PROPER(MID(B2,FIND(" ", B2)+1,IF(ISNUMBER(FIND(" ", B2,FIND(" ", B2)+1)),FIND(" ", B2,FIND(" ", B2)+1)-FIND(" ", B2)-1,LEN(B2)-FIND(" ", B2))))&

2015-05-27 16:21:10 補充:
IF(LEN(B2)-LEN(SUBSTITUTE(B2," ",""))>=2,"-"&LOWER(RIGHT(B2,LEN(B2)-FIND(" ", B2,FIND(" ", B2)+1))),""),LOWER(RIGHT(B2,LEN(B2)-IF(ISNUMBER(FIND(",",B2)),FIND(",",B2)+1,LEN(B2)))),PROPER(RIGHT(B2,LEN(B2)- IF(ISNUMBER(FIND(",",B2)),FIND(",",B2)+1,LEN(B2))))),TRIM(B2)&TRIM(A2))

2015-05-27 16:24:58 補充:
由於公式太長,請將兩段自行接駁,中間不能有空格。

2015-05-28 16:51:04 補充:
由於並未提及「台啟」、「台鑒」、「收」在甚麼情況用那個詞,假設可能自訂每次不同,請自行置換公式中「台啟」字眼(但不要覆蓋了「台啟」前面的空格):
=IF(CODE(LEFT(A2,1))<256,IF(LEN(TRIM(A2))>0,PROPER(TRIM(A2))&" ","")&SUBSTITUTE(UPPER(LEFT(B2,FIND(" ", B2)))&

2015-05-28 16:52:13 補充:
PROPER(MID(B2,FIND(" ", B2)+1,IF(ISNUMBER(FIND(" ", B2,FIND(" ", B2)+1)),FIND(" ", B2,FIND(" ", B2)+1)-FIND(" ", B2)-1,LEN(B2)-FIND(" ", B2))))&IF(LEN(B2)-LEN(SUBSTITUTE(B2," ",""))>=2,

2015-05-28 16:53:05 補充:
"-"&LOWER(RIGHT(B2,LEN(B2)-FIND(" ", B2,FIND(" ", B2)+1))),""),LOWER(RIGHT(B2,LEN(B2)-IF(ISNUMBER(FIND(",",B2)),FIND(",",B2)+1,LEN(B2)))),

2015-05-28 16:53:22 補充:
PROPER(RIGHT(B2,LEN(B2)- IF(ISNUMBER(FIND(",",B2)),FIND(",",B2)+1,LEN(B2))))),TRIM(B2)&TRIM(A2)&" 台啟")

2015-05-28 16:54:26 補充:
由於公式太長,請將四段自行接駁,中間不能有空格。


收錄日期: 2021-04-11 21:06:58
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20150526000051KK00056

檢視 Wayback Machine 備份