当前位置:网站首页>1. Excel的IF函数
1. Excel的IF函数
2022-07-26 04:13: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. 总结

边栏推荐
- 5 years, 1.4W times, NFT og's road to immortality Web3 column
- Web测试方法大全
- The PHP Eval () function can run a string as PHP code
- Lua and go mixed call debugging records support cross platform (implemented through C and luajit)
- APISIX 在 API 和微服务领域的探索
- 解决:RuntimeError: Expected object of scalar type Int but got scalar type Double
- Recommendation | DBT skills training manual: baby, you are the reason why you live
- When you try to delete all bad code in the program | daily anecdotes
- Huawei executives talk about the 35 year old crisis. How can programmers overcome the worry of age?
- dijango学习
猜你喜欢
![Acwing game 61 [End]](/img/e3/191f7d888fc8cced608d41ef837a92.png)
Acwing game 61 [End]

Acwing第 61 场周赛【完结】

Dracoo master

Synchronous FIFO based on shift register

Retail chain store cashier system source code management commodity classification function logic sharing
![[project chapter - how to write and map the business model? (3000 word graphic summary suggestions)] project plan of innovation and entrepreneurship competition and application form of national Entrep](/img/e8/b115b85e2e0547545e85b2058a9bb0.png)
[project chapter - how to write and map the business model? (3000 word graphic summary suggestions)] project plan of innovation and entrepreneurship competition and application form of national Entrep

Recommendation Book Educational Psychology: a book for tomorrow's teachers~
![[Reading Notes - > data analysis] 01 introduction to data analysis](/img/50/622878bf649e77d5a4fa9732fa6f92.png)
[Reading Notes - > data analysis] 01 introduction to data analysis

How to build an enterprise level OLAP data engine for massive data and high real-time requirements?

1. Mx6u-alpha development board (main frequency and clock configuration experiment)
随机推荐
零售连锁门店收银系统源码管理商品分类的功能逻辑分享
Implementation of distributed lock
APISIX 在 API 和微服务领域的探索
Pits encountered by sdl2 OpenGL
Basic principles of iptables
[SVN] please execute the 'cleanup' command appears all the time. The solution is that there is no response after cleanup
雅迪高端之后开始变慢
荐书丨《教育心理学》:送给明日教师的一本书~
Synchronous FIFO based on shift register
Worked overtime for a week to develop a reporting system. This low code free it reporting artifact is very easy to use
Wechat applet to realize music player (4) (use pubsubjs to realize inter page communication)
Luoda development - audio stream processing - AAC / loopbacktest as an example
测试用例设计方法之:入门试招,等价边界初探
图互译模型
What format should be adopted when the references are foreign documents?
Share | 2022 big data white paper of digital security industry (PDF attached)
p-范数(2-范数 即 欧几里得范数)
Inventory the concept, classification and characteristics of cloud computing
Method of test case design -- move combination, causal judgment
Soft simulation rasterization renderer