How to sum set of contiguous appearance values among set of multiple valued duplicates in excel?

deputat_x

New Member
Joined
Oct 23, 2016
Messages
10
Dear All! I thought it will be easy to sum up multiple distinct values among duplicates but when I started to do that I stucked finally. My need is far beyond that is why I need your assistance, please.
The scenario: If a text value is duplicated in a specific range of column A (e.g.), I need to sum all the values of column B (e.g.) that are on the same row as the duplicate entry A and list that value in the row where the "last" (down in the column) duplicate entry is situated each time when a series of duplicates entry appear again.
Example:
<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; white-space: inherit;">
</code>
A:1 NeutralB:1 0C:1 1
A:2 GoodB:2 1C:2
A:3 GoodB:3 1C:3 2
A:4 BadB:4 -1C:4
A:5 BadB:5 -1C:5
A:6 BadB:6 -1C:6 -3
A:7 GoodB:7 1C:7 1
A:8 BadB:8 -1C:8
A:9 BadB:9 -1C:9 -2
A:10 GoodB:10 1C:10
A:11 GoodB:11 1C:11 2
A:12 NeutralB:12 0C:12 1

<tbody>
</tbody>
<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; white-space: inherit;">

</code>As you can see, Column A has sets of multiple valued duplicates and one valued duplicates:

  • “Good” is duplicated 2 timesby 2 values and 1 time by 1 value;
  • “Bad” is duplicated 1 time * by 3 values and 1 time* by 2 values;
  • “Neutral” is duplicated 2 times* by 1 value.
I need to sum ONLYcontiguous appearance values of column B in the rows where the “Neutral” is duplicated in column A ( C:1 answer = 1 and C:12 answer =1), the “Good” in column A ( C:3 answer = 2, C:7 answer =1, and C:11 answer =2 ) and finally for the “Bad” in Column A (C:6 answer=-3, and C:9 answer = -2 ).

Where in column C?


In addition to the above, I need the formula to write the totals of each changing distinct duplicates in the row of each last unique duplicate number, that is:

<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; white-space: inherit;"> 1 must be placed in C:1;
2 must be placed in C:3
(-)3 must be placed in C:6;
1 must be placed in C:7;
(-)2 must be placed in C:9;
2 must be placed in C:11; and
1 must be placed in C:12.
</code>

I think that's it. Thank you all.

Kind regards, Robin
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Have you looked at SUMIF

=SUMIF(A:A, "neutral", B:B) will return the sum of entries in columnB, that are on the same row as a cell in column A that contains "neutral"
 
Upvote 0
Have you looked at SUMIF

=SUMIF(A:A, "neutral", B:B) will return the sum of entries in columnB, that are on the same row as a cell in column A that contains "neutral"

I tried to calculate the way you've recommended but it calculates total of all appearances. I need the formula to write the totals of the duplicates in the row of each LAST (contiguous appearances) unique duplicate values.
 
Upvote 0
I don't understand what you mean by "LAST (contiguous appearances) unique duplicate values"

In the OP data, what rows does that refer to?
 
Upvote 0
Look, in your recommeded function (sumif) I get for "Neutral" in C:1, 1. And for "Good" in C:2 and C:3, I get 1 in either field again. I need to get "Totals" in C:3 equal to 2, C:2 should be empty field. Please see my table in Column C there what I exactly need.
 
Upvote 0
See if this does what you need.
**Note that i added column headers - they are necessary for the formula work correctly***


A
B
C
1
Header1​
Header2​
Result​
2
Neutral​
0​
1​
3
Good​
1​
4
Good​
1​
2​
5
Bad​
-1​
6
Bad​
-1​
7
Bad​
-1​
-3​
8
Good​
1​
1​
9
Bad​
-1​
10
Bad​
-1​
-2​
11
Good​
1​
12
Good​
1​
2​
13
Neutral​
0​
1​

Formula in C2 copied down
=IF(A2=A3,"",COUNTIF(A2:INDEX(A$1:A1,LOOKUP(2,1/(A$1:A1<>A2),ROW(A$1:A1)-ROW(A$1)+1)),A2)*IF(A2="Bad",-1,1))

Hope this helps

M.
 
Upvote 0
See if this does what you need.
**Note that i added column headers - they are necessary for the formula work correctly***


A
B
C
1
Header1​
Header2​
Result​
2
Neutral​
0​
1​
3
Good​
1​
4
Good​
1​
2​
5
Bad​
-1​
6
Bad​
-1​
7
Bad​
-1​
-3​
8
Good​
1​
1​
9
Bad​
-1​
10
Bad​
-1​
-2​
11
Good​
1​
12
Good​
1​
2​
13
Neutral​
0​
1​

<tbody>
</tbody>


Formula in C2 copied down
=IF(A2=A3,"",COUNTIF(A2:INDEX(A$1:A1,LOOKUP(2,1/(A$1:A1<>A2),ROW(A$1:A1)-ROW(A$1)+1)),A2)*IF(A2="Bad",-1,1))

Hope this helps

M.
You are Brilliant! Thank you so so much!:)
 
Upvote 0

Forum statistics

Threads
1,214,921
Messages
6,122,280
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top