当前位置:网站首页># 1. Excel的IF函数
# 1. Excel的IF函数
2022-07-25 04:06:00 【安迪Python】
1. Excel的IF函数
1. 任务
计算每个员工的7月销售奖金。
根据7月销售业绩是否大于6月销售业绩,来确定销售奖金:
如果7月销售业绩大于6月销售业绩,发奖金2000元。
如果7月销售业绩小于等于6月销售业绩,发奖金600元。

2. IF 函数的语法
【函数释义】
如果满足条件,就...,否则...。
【语法】
=IF ( 测试条件, 真值, 假值 ) =IF(logical_test , value_if_true , value_if_false)
如果满足“测试条件”,往单元格填充真值。
如果不满足“测试条件”,往单元格填充假值。
【函数名】IF
【参数1】测试条件
【参数2】真值
【参数3】假值
【温馨提示】3个参数之间用英文逗号隔开,英文逗号。
3. 示例1
如果明天不下雨,我们就去打篮球,否则我们就在宿舍打游戏。
=IF(明天不下雨, 打篮球, 打游戏)
【测试条件】明天不下雨
【真值】打篮球
【假值】打游戏
4. 实战练习
如果7月销售业绩大于6月销售业绩,发奖金2000元。
如果7月销售业绩小于等于6月销售业绩,发奖金600元。
=IF(7月销售业绩大于6月销售业绩,2000, 600)=IF( 测试条件, 真值, 假值)
【测试条件】7月销售业绩大于6月销售业绩。
【真值】2000
【假值】600
5.操作步骤
1.单击E3单元格;
2.单击“公式”选项卡;
3.单击“公式”选项卡下的“插入函数”选项卡;
4.在“选择函数”区域找到并点击IF;
5.点击确定;
6.在“测试条件”框中输入:D3>C3;(在英文输入法状态下,按Shift+>键即可输入>) ;
6.点击“测试条件”框,点击D3单元格,输入> ,点击C3单元格(第6步也可以这样做);
7.“真值”框中输入2000;
8.“假值”框中输入600;
9.点击确定;到这里就成功计算出了刘一的奖金。
10.点击E3单元格,把鼠标放到E3单元格的右下角,出现黑色“十”字柄后,双击鼠标左键,E3以下所有行都被自动填充了,函数就可以自动算出了所有员工的销售奖金。


6. 查看公式
点击E3单元格,在上面的长方形区(编辑栏)会显示这个单元格的函数公式内容:
=IF(D3>C3,2000,600)
熟练掌握公式后我们也可以直接在单元格中输入上述公式。

7. IF 函数嵌套
【任务】
【成绩】>=600 :一本
【成绩】400-600 :二本
【成绩】<400:落榜
第一个IF函数
【测试条件】成绩>=600
【真值】一本
【假值】嵌套一个IF函数,继续判断
第二个IF函数
【测试条件】400-600
【真值】二本
【假值】落榜
【操作步骤】
1.单击E3单元格;
2.单击“公式”选项卡;
3.单击“公式”选项卡下的“插入函数”选项卡;
4.在“选择函数”区域找到并点击IF;
5.点击确定;
6.点击“测试条件”框,点击D3单元格,输入>=600;
7.“真值”框中输入一本;
8.点击“假值”框;
9.单击“公式”选项卡下的“插入函数”选项卡;
10.在“选择函数”区域找到并点击IF;
11.点击确定;
12.点击“测试条件”框,点击D3单元格,输入>=400;
13.“真值”框中输入二本;
14.“假值”框中输入落榜;
15.点击确定;到这里就成功计算出了刘一的录取情况;
16.点击E3单元格,把鼠标放到E3单元格的右下角,出现黑色“十”字柄后,双击鼠标左键,E3以下所有行都被自动填充了,函数就可以自动算出了所有学生的录取情况。
【查看公式】
=IF(D3>=600,"一本",IF(D3>=400,"二本","落榜"))
8. 多条件并列判断
【任务】
30岁以下的学生,火车票五折,其余的原价。
【测试条件】学生+30岁以下 【真值】五折
【假值】原价
【测试条件】AND(C3="学生",D3<30) 【真值】五折
【假值】原价
【操作步骤】
1.单击E3单元格;
2.单击“公式”选项卡;
3.单击“公式”选项卡下的“插入函数”选项卡;
4.在“选择函数”区域找到并点击IF;
5.点击确定;
6.点击“测试条件”框; 7.输入'AND';
8.输入英文前括号;
9.点击点击C3单元格,输入="学生",;注意符号都是英文状态下输入;
10.点击D3单元格,输入<30;注意符号都是英文状态下输入;
11.输入英文后括号;
12.“真值”框中输入五折;
13.“假值”框中输入原价;
14.点击确定;到这里就成功计算出了刘一购买火车票的优惠情况。

【查看公式】
=IF(AND(C3="学生",D3<30),"五折","原价")
【温馨提示】注意公式里的符号都是在英文状态下输入。
9. 总结

边栏推荐
- Grafana visual configuration diagram histogram
- ADS1256 debugging notes based on stm32hal Library
- Construction of data center (I): background of the emergence of data center
- LVGL 8.2 Message box
- Leetcode:733. image rendering [BFS]
- Es- retrieve the selected field from the search
- Penetration test target combat SQL injection getshell
- LVGL 8.2 Slider
- GDAL image resampling
- Win11 experience
猜你喜欢

Installation and tutorial of MATLAB curling simulation game

Wechat applet application development (I)

Internship in 2022

Typical data Lake application cases

实战|记一次攻防演练打点

Jenkins continues to integrate entry to mastery

Custom dialog (including header and footer)

运筹学基础【一】 之 导论

Pandora IOT development board learning (RT thread) - Experiment 16 WiFi module experiment (learning notes)

开源之夏专访|“00 后” PMC member 白泽平
随机推荐
如何取得数据库创建时间?
DNS domain name resolution service
Apache Doris series: in depth understanding of real-time analytical database Apache Doris
Metinfo function public function getcity() error: XXX function no permission load!!!
Interpretation and download of the report | ink Tianlun July database industry report, be prepared for danger in times of safety, and safety first
The United States has launched 337 investigations on a number of Chinese companies: Bubugao is full of lying guns!
GDAL image resampling
ADS1256 debugging notes based on stm32hal Library
RGB and SATA function switching module based on Quanzhi rk3568j
In the process of data migration from Oracle to polardb for PostgreSQL, what does data migration mean?
When the development of the meta universe begins to show more and more the style of the Internet, we need to be vigilant
Which securities company do retail investors choose for stock speculation? Is it safe to open an account on your mobile phone
Roleapp focuses on Web3 and opens the door of Web3 with the key of "data can be held"
Behind Senma's LP, "Wenzhou Department" is running into the venture capital circle
GBase JDBC 连接数据库异常
Press the switch for the minimum number of times to turn on all lights
Sony announced the closure of Beijing mobile phone factory! The production line will be moved to Thailand, and the cost can be reduced by half!
Max matrix and JS
Construction of data center (I): background of the emergence of data center
Analytic hierarchy process of MATLAB