My goal is to fill out the third column in the second table and identify whether an ID has been completed or not.
I want to find the ID from table 2 in table 1, then pull the value in the completed column in table 1, but only if it's later than the date in table 2. If I can also pull the date / time from table 1 for the completed records, that would be a bonus.
Example:
This is not the real data, I simplified this for the purpose of posting on here. The real data is contained in a very large excel sheet.
Table 1:
[TABLE="width: 500"]
<tbody>[TR]
[TD]Completed[/TD]
[TD]ID[/TD]
[TD]Date / Time[/TD]
[/TR]
[TR]
[TD]completed[/TD]
[TD]1[/TD]
[TD]8/1/2019[/TD]
[/TR]
[TR]
[TD]pending[/TD]
[TD]2[/TD]
[TD]8/5/2019[/TD]
[/TR]
[TR]
[TD]completed[/TD]
[TD]3[/TD]
[TD]7/2/2019[/TD]
[/TR]
[TR]
[TD]pending[/TD]
[TD]3[/TD]
[TD]8/5/2019[/TD]
[/TR]
[TR]
[TD]completed[/TD]
[TD]3[/TD]
[TD]8/30/2019[/TD]
[/TR]
[TR]
[TD]pending[/TD]
[TD]3[/TD]
[TD]8/31/2019[/TD]
[/TR]
[TR]
[TD]cancelled[/TD]
[TD]4[/TD]
[TD]9/5/2019[/TD]
[/TR]
</tbody>[/TABLE]
Table 2:
[TABLE="width: 500"]
<tbody>[TR]
[TD]ID[/TD]
[TD]Date / Time[/TD]
[TD]Completed in Table 1?[/TD]
[TD]Table 1 Date / Time?[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]8/29/2019[/TD]
[TD]?[/TD]
[TD]?[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]8/29/2019[/TD]
[TD]?[/TD]
[TD]?[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]8/1/2019[/TD]
[TD]?[/TD]
[TD]?[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]9/5/2019[/TD]
[TD]?[/TD]
[TD]?[/TD]
[/TR]
</tbody>[/TABLE]
I want to find the ID from table 2 in table 1, then pull the value in the completed column in table 1, but only if it's later than the date in table 2. If I can also pull the date / time from table 1 for the completed records, that would be a bonus.
Example:
- The completed column in table 2 for ID 1 should be 'pending' or error, because the date for that ID in table 2 is later than the date in table 1.
- The completed column in table 2 for ID 3 should be 'completed', because at least one record is completed in table 1. (the completed date in column 4 would be 8/30/2019. Note: it's completed even the latest record is 'pending'. If at least one completed record is after the date listed on table 2, it should be listed as completed.
This is not the real data, I simplified this for the purpose of posting on here. The real data is contained in a very large excel sheet.
Table 1:
[TABLE="width: 500"]
<tbody>[TR]
[TD]Completed[/TD]
[TD]ID[/TD]
[TD]Date / Time[/TD]
[/TR]
[TR]
[TD]completed[/TD]
[TD]1[/TD]
[TD]8/1/2019[/TD]
[/TR]
[TR]
[TD]pending[/TD]
[TD]2[/TD]
[TD]8/5/2019[/TD]
[/TR]
[TR]
[TD]completed[/TD]
[TD]3[/TD]
[TD]7/2/2019[/TD]
[/TR]
[TR]
[TD]pending[/TD]
[TD]3[/TD]
[TD]8/5/2019[/TD]
[/TR]
[TR]
[TD]completed[/TD]
[TD]3[/TD]
[TD]8/30/2019[/TD]
[/TR]
[TR]
[TD]pending[/TD]
[TD]3[/TD]
[TD]8/31/2019[/TD]
[/TR]
[TR]
[TD]cancelled[/TD]
[TD]4[/TD]
[TD]9/5/2019[/TD]
[/TR]
</tbody>[/TABLE]
Table 2:
[TABLE="width: 500"]
<tbody>[TR]
[TD]ID[/TD]
[TD]Date / Time[/TD]
[TD]Completed in Table 1?[/TD]
[TD]Table 1 Date / Time?[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]8/29/2019[/TD]
[TD]?[/TD]
[TD]?[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]8/29/2019[/TD]
[TD]?[/TD]
[TD]?[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]8/1/2019[/TD]
[TD]?[/TD]
[TD]?[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]9/5/2019[/TD]
[TD]?[/TD]
[TD]?[/TD]
[/TR]
</tbody>[/TABLE]
Last edited: