当前位置:网站首页># 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. 总结

边栏推荐
- 运筹学基础【一】 之 导论
- The latest Matlab download and installation tutorial (with files)
- EMQ Yingyun technology was successfully selected into the 2022 "cutting edge 100" list of Chinese entrepreneurs
- Introduction to computing system hardware (common servers)
- Numpy overview
- Roleapp focuses on Web3 and opens the door of Web3 with the key of "data can be held"
- Paper:《Peeking Inside the Black Box: Visualizing Statistical Learning with Plots of Individual Condi
- Wechat applet experiment case: simple idiom dictionary
- Current characteristics of steering gear with great resistance
- 实战|记一次攻防演练打点
猜你喜欢

Huawei cloud from entry to actual combat | cloud rapid site establishment service and enterprise host security service

Properties of trees

Behind Senma's LP, "Wenzhou Department" is running into the venture capital circle

Kubesphere 3.3.0 offline installation tutorial

开源之夏专访|“00 后” PMC member 白泽平

Tiktok live broadcast brings goods to help the industry go to sea, and Fastdata observation industry boutique salon helps the ecological development

Student thinking vs workplace thinking

High temperature in Britain: two airport runways were burnt out, and several railways were restricted to ensure safety
![[golang from introduction to practice] poker licensing game](/img/b4/4e8bc421f82e9dcdaa48381154bfc8.png)
[golang from introduction to practice] poker licensing game

Grafana visual configuration diagram histogram
随机推荐
Paper:《Peeking Inside the Black Box: Visualizing Statistical Learning with Plots of Individual Condi
MongoDB的安全认证详解
Press the switch for the minimum number of times to turn on all lights
Beijing University of Posts and telecommunications | RIS assisted in-house multi robot communication system joint deep reinforcement learning
Hbuilderx eslint configuration
Which stock exchange has the lowest commission? Is online account manager safe to open an account
Current characteristics of steering gear with great resistance
Source code analysis of ArrayList
LVGL 8.2 Slider
Debezium series: optimize cluster parameters and support personalized settings of debezium connector
[detailed tutorial] a thorough article on mongodb aggregation query
Divide candy Huawei od JS
After the failure of listing in Hong Kong, tuba rabbit terminated its gem IPO, and the founder responded
Creativity: presentation of AI oil paintings with high imitation mineral pigments
Maker concept design to adapt to popular education
数据中台建设(一):数据中台出现的背景
Visual studio 2019 installation and uninstallation problems
Implementation of some basic operation codes of string
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!
How many rows does PostgreSQL need to partition for each table?