Multi Row Subtraction/Addition
- 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
HI Team,
I have the below requirement.
Input:
row no. | EMP ID | Code | A | B |
1 | 123 | L | 19 | |
2 | 123 | L | 30 | |
3 | 123 | L | 32 | |
4 | 123 | L | 37 | |
5 | 123 | D | 14 | |
6 | 123 | D | 24 | |
7 | 123 | D | 37 |
The Column B calculation should be done grouped by EMP ID & Code. Wondering if this can be achieved through multirow tool. Appreciate any help around this.
Required Output:
row no. | EMP ID | Code | A | B | ||
1 | 123 | L | 19 | 19 | B1=A1 | |
2 | 123 | L | 30 | 11 | B2=A2-A1 | |
3 | 123 | L | 32 | 2 | B3=A3-(A2+A1) | |
4 | 123 | L | 37 | 5 | B4=A4-(A3+A2+A1) | |
5 | 123 | D | 14 | 14 | B6=A6 | |
6 | 123 | D | 24 | 10 | B7=A7-A6 | |
7 | 123 | D | 37 | 13 | B8=A8-(A7+A6) |
Solved! Go to Solution.
- Labels:
- Common Use Cases
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
HI @Qiu Apologies for the typo. Thanks for highlighting . Please find the updated output below.
EMP ID | Code | A | B | |||
1 | 123 | L | 19 | 19 | B1=A1 | |
2 | 123 | L | 30 | 11 | B2=A2-A1 | |
3 | 123 | L | 32 | 2 | B3=A3-(B2+B1) | |
4 | 123 | L | 37 | 5 | B4=A4-(B3+B2+B1) | |
5 | 123 | D | 14 | 14 | B5=A5 | |
6 | 123 | D | 24 | 10 | B6=A6-A5 | |
7 | 123 | D | 37 | 13 | B7=A7-(B6+B5) |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@hemant86
you can refer the solution attached
i guess that solves the problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thanks @Raj I was under an impression that the multi row formula you used will minus only the immediate previous row. Appreciate if you could share some insight on how it is taking sum of all previous rows and then doing a minus. Thanks again for the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@hemant86 Just used the basic math's to fulfill your requirement but
to answer your question
we can change this and this should work for multiple rows as well
hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@Raj If I'm getting your point correct, the number of rows for each employee in my data is not fixed. Keeps varying.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@hemant86
no this is not restricted to number of rows.
this is dynamic and will work for any number of rows.
