简体   繁体   English

比较2个工作表中的行并更新特定列

[英]Compare rows from 2 worksheets and update a specific column

Please see attached picture. 请看所附图片。

Workbook 1 is the end product of merging, comparing, formatting, and calculating datasets from a couple of sources. 工作簿1是合并,比较,格式化和计算来自多个来源的数据集的最终产品。 At the beginning of each month, one of the sources gets a staffing update. 在每个月的月初,其中一个消息来源会更新人员编制。 While this update is running, the 在运行此更新时, 在此处输入图片说明 data represented in Column O will contain 0's. O列中表示的数据将包含0。 The process takes several hours, but data is updated in this workbook each hour. 该过程需要几个小时,但是每小时都会在此工作簿中更新数据。

What I need to achieve is running a report after the staffing update is completed (represented by Workbook 2) and comparing the data in Workbook 2 to Workbook 1. If ALL data in each row matches between the two workbooks, except for Column O, then Column O needs to get updated from Workbook 2. I should note that the data in the two workbooks will be identical except in column O. 我需要实现的是在人员配备更新完成运行报告(由工作簿2表示),并将工作簿2中的数据与工作簿1进行比较。如果除O列外,每行中的所有数据都在两个工作簿之间匹配,则O列需要从工作簿2中进行更新。我应该注意,除了O列之外,两个工作簿中的数据都相同。

I have looked at other questions/answers on other forums and here in SO, but cannot find anything that matches what I need. 我在其他论坛和SO的其他地方查看过其他问题/答案,但找不到与我需要的内容匹配的任何内容。 If there is an answer out there that matches my requirements, please comment me the link. 如果有符合我要求的答案,请给我评论链接。

Take all the rows except for Row O and put them in a long string, that is (concatenate them in a line) and use an IF THEN statement comparing the differences. 取出除行O以外的所有行,并将它们放在一个长字符串中(即将它们连接在一行中),并使用IF THEN语句比较差异。 If a difference is found between the rows, you can then update them with the value of Column O from Workbook 2. 如果发现行之间存在差异,则可以使用工作簿2中的列O的值来更新它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM