编写函数实现员工信息录入和输出_掌握这9个函数公式,30秒完成900个员工的信息录入...

员工基本信息的录入和整理,是人事工作中非常重要的一项基本工作,那么HR如何实现员工信息的快速、准确录入呢?

我们来看下员工信息表里面需要用到的这些函数公式:

940b0aada134db70e40f4f1ffee2c41a.png

1、判断员工性别

=IF(MOD(MID(E2,17,1),2)=1,'男','女')

2、提取员工生日

=--TEXT(MID(E2,7,8),'0-00-00')

3、计算员工年龄

=YEAR(TODAY())-MID(E2,7,4)

4、判断员工籍贯

=LEFT(VLOOKUP(LEFT(E2,6),行政区域代码!A:B,2,0),3)

5、计算员工工龄

=DATEDIF($S2,TODAY(),'Y')&'年'&DATEDIF($S2,TODAY(),'YM')&'个月'

6、计算员工司龄

=DATEDIF(M2,TODAY(),'y')

7、计算员工转正日期

=DATE(YEAR(M2),MONTH(M2)+3,DAY(M2))

8、设置员工生日提醒

=TEXT(10-DATEDIF(G2-10,TODAY(),'YD'),'还有0天生日;;今天生日')

9、计算员工退休时间

=IF(F2='男',EDATE(G2,12*60)+1,EDATE(G2,12*55)+1)

熟练掌握以上这些函数公式,HR面对再多的员工信息也不会手忙脚乱了!

当然,员工信息管理只是人事工作中的一小部分,还有员工的考勤统计、合同管理、工资核计、员工考核以及人力资源分析等工作,这些也都需要强大的Excel功能支持:

考勤统计▼

a6cd9cd39510e3a912652f14786834d3.gif

工资核计▼

f4f2e406694926dcd69a6a94ce75b560.gif

合同管理▼

2af0e27cf9aa43d881ca16036d31b12b.gif

员工考评▼

08e75f3f3f79c7d15ab050d22eb72f5b.gif

人员流动分析▼

67cc27d098ba7eb925185887c9c40fde.gif

利用好Excel这个强大的工具,可以让你平时2小时的工作量变为5分钟,切实提高工作效率!


来源:Excel技巧精选

创建一个人事管理系统,我们可以使用C++的结构体来表示员工信息,链表(如单链表或双向链表)来存储这些信息,同时利用文件I/O来实现数据的持久化。这里是一个简单的示例,演示如何使用单链表和文本文件进行操作: 首先,定义一个Employee结构体,包含姓名、工号和职位等字段: ```cpp struct Employee { string name; int id; string position; struct Node *next; // 链表节点,指向下一个员工 }; ``` 然后,定义链表操作相关的函数: 1. 插入新员工到链表末尾: ```cpp void insert(Employee *&head, const Employee &newEmp) { if (head == nullptr) { head = new Employee{newEmp.name, newEmp.id, newEmp.position, nullptr}; } else { Employee *current = head; while (current->next != nullptr) { current = current->next; } current->next = new Employee{newEmp.name, newEmp.id, newEmp.position, nullptr}; } } ``` 2. 修改员工信息: ```cpp void update(Employee **node, const Employee &newEmp) { if (*node != nullptr && (*node)->id == newEmp.id) { (*node)->name = newEmp.name; (*node)->position = newEmp.position; } } ``` 3. 读取并显示链表的所有员工: ```cpp void displayList(const Employee *head) { if (head == nullptr) { cout << "No employees in the list.\n"; } else { while (head != nullptr) { cout << "ID: " << head->id << ", Name: " << head->name << ", Position: " << head->position << endl; head = head->next; } } } ``` 接下来,处理文件操作: 1. 从文件读取员工信息并插入链表: ```cpp void loadFromFile(Employee *&head, const string &filename) { ifstream file(filename); if (file.is_open()) { string line; while (getline(file, line)) { stringstream ss(line); Employee newEmp; getline(ss, newEmp.name, ','); ss >> newEmp.id; getline(ss, newEmp.position, '\n'); insert(head, newEmp); } file.close(); } else { cerr << "Unable to open the file." << endl; } } ``` 2. 将链表保存到文件: ```cpp void saveToFile(const Employee *head, const string &filename) { ofstream file(filename); if (file.is_open()) { for (const Employee *emp = head; emp != nullptr; emp = emp->next) { file << emp->name << "," << emp->id << "," << emp->position << endl; } file.close(); } else { cerr << "Unable to open the file for writing." << endl; } } ``` 现在你可以根据需求组合这些函数,例如在主程序先加载数据,然后添加/修改员工,最后保存到文件。记得在每个操作后检查文件是否成功打开和关闭。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值