EXCEL IF 問題

2007-12-04 11:17 pm
若我想在EXCEL的IF功能中得出以下結果,可怎樣輸入公式:
若在A1:A5中是A或B,就顯示1,否則顯示2

回答 (2)

2007-12-04 11:27 pm
✔ 最佳答案
注意: A1:A5中是A或B
所以: 要用埋or

if 最基本用法: =if(a1=a, "1", "2")
即係如果a1係a, show1, 否則2

加埋or
=IF(OR(a1=a, a1=b), "1", "2")
2007-12-05 6:06 am
You can put this formula in cell B1, so that excel will count from range A1:A5 to see whether it has A or B. If either A or B is found within the range, it will return 1, otherwise it will return 2.

=IF(OR(COUNTIF(A1:A5, "A" )>0,COUNTIF(A1:A5, "B" )>0),1,2)

P.S. remove the symbol semi-colon (;) from the equation, for some reason it appears above. The correct formula should not have that semi-colon...........

I hope that helps.
參考: myself


收錄日期: 2021-04-26 16:57:14
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20071204000051KK01285

檢視 Wayback Machine 備份