Inserting new rows into data table with ID’s
Hey everyone 👋🏼 It was hard to briefly describe this issue in the subject!
I have a dataset in an Excel table, and each row has already been assigned a numeric ID. The data is essentially time data for a fortnight (columns are ID, employee name, date, clock in, clock out, hours worked).
The assigned ID is very important as it represents the position of the employee within each timesheet file.
My issue is that there are rows missing from the original data set and these rows (ie. days of work) have to be manually created (in a separate table) and added into the original table so that each employee has 14 rows per fortnight. There are multiple employees per timesheet and hundreds of fortnights, and it is imperative that the “order” of the employees appearing in each timesheet is preserved.
(So Billy’s times are - or should be - the first 14 rows of the table, then Bob has 14 rows, then Karen - and so on).
However because the ID has already been assigned (with the belief that there were no missing rows), these new rows will not have an ID. So if I append the new rows into the main table, and order by ID, the original order is going to get messed up if there are blank values in the ID field.
So let’s say the 10th day of the fortnight for Billy was missing (the first employee in the data set) and I create the row and go to append the data into the table, how can I insert the row to ensure the original ordering is maintained.
The ID for the 10th day should be 10, however as the row was missing when the row ID’s were initially assigned/generated, the row with the ID of 10 is actually the 11th day.
Any advice / tips would be appreciated. Thank you! 🙏
[link] [comments]
Want to read more?
Check out the full article on the original site