我試圖做一個多級別,如果其他查詢在Excel中,它將檢查多個變量,如果它落入其中一個類別那麼它會 - 一個百分比,如果它不屬於任何類別那麼它會說「N/A」如何在excel中查詢其他查詢?
的僞代碼將是這個樣子:
If $income <90,000 and $age is <65 then - 27.82%,
else if $income range(90,000 - 105,000) and $age <65 then $premium - 18.55%,
else if $income range(105,001 - 140,000) and $age <65 then $premium - 9.27%,
else if $income >140,000 and $age <65 then - 0%,
else if $income <90,000 and $age range(65-69) then $premium - 32.46%,
else if $income range(90,000 - 105,000) and $age range(65-69) then $premium - 23.18%,
else if $income range(105,001 - 140,000) and $age range(65-69) then $premium - 13.91%,
else if $income >140,000 and $age range(65-69) then $premium - 0%,
else if $income <90,000 and $age <70 then - 37.09%,
else if $income range(90,000 - 105,000) and $age <70 then $premium - 27.82%,
else if $income range(105,001 - 140,000) and $age <70 then $premium - 18.55%,
else if $income >140,000 and $age <70 then $premium - 0%,
else "NA";
$income = cell j4
$age = cell i4
$premium = cell q4
我能夠做一個單級查詢看起來是這樣的:
=IF(AND(I5>64,I5<69,J5>90000,J5<105001),800*$Y$5,"NA")
但我不知道如何做多個我f else在excel中的語句來捕獲所有可能的類別,或者如果有更好的方法。
你可以嵌套IF函數來實現這一點,語法是這樣= IF(Condition,TRUE,IF(Condition,TRUE,IF(....))) –