Conditionally subtract rows using Two Tables
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I have two tables, given as Table 1 and Table 2 below:
Now, if for a given Code, there are values in Table 1 which match Table 2, then I want the rows in Table 1 to be subtracted using the rows from Table 2. For example for Code AAA, since Val1 = 100 in Table 1, then I must subtract 10, 20, and 10 from it to get the final value of 60. Similarly for AAA Val2, it is 200 - 5 - 30 - 50 = 115.
After this is done, I then want to merge the rows from Table 2 onto Table 1 such that I get the final table below:
I have also attached a sample excel file with the data
If anyone can help me with this it would be greatly appreciated, thank you!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
hi, @dmc141
Summarize Table2 in Code.
Then, join it with Table1.
After that, perform the necessary calculations and UNION the results.
I will attach the workflow for details, so please check it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@ntakeda Thank you again for your help - this is the second time you have answered my question in as many days, I greatly appreciate it!
