SUMIFS formula? Maybe?

ConVermin

New Member
Joined
Sep 21, 2022
Messages
4
Office Version
  1. 365
  2. 2021
  3. 2019
Platform
  1. Windows
This will likely be long winded, I apologize now. (some data removed and names changed for NDA reasons)
Basically I'm trying to sum these by the number in the middle, using the Plus/minus and Steak/Pastry/Apples. In the full dataset, the numbers in the middle repeat and are shared by pastry and steak. For example, A number can both be plus and minus while also being from Pastry, Steak, and Apple. The formula I had prior =SUMIF(A:B,A2,B:B), would add up the numbers correctly, but I still have the issue of having multiple sums for the same concate in use.

I tried to explain it the best I could. If I didn't make sense I'm so sorry, I will try to explain further if need be.

Concate in useValue to be AddedSUM
Pastry;1002757132;Plus-4
Steak;1002757126;Plus-12
Steak;526749;Plus-10
Steak;201032;Minus2
Apples;207598;Plus-6
Steak;224892;Minus2
Steak;155460;Minus4
Steak;155559;Plus-4
Steak;713708;Plus-2
 

Attachments

  • Sample.png
    Sample.png
    30.6 KB · Views: 20

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Welcome to the Board!

I am sorry, but I really do not understand your question (and the fact that no one else has replied seems to suggest others may not understand either).
Can you show us what the EXPECTED result of your example should look like, and walk us through a calculation or two, step-by-step?
 
Upvote 0
Sure! Maybe this will help. I probably should have included this the first time around. In the below, Apple has both a minus and plus, with values that are needed to be summed together. In this example,
Apple;666609;Plus, would only occupy one row to make it easier to vlookup in-between sheets.


Concate in useValue to be AddedSUM
Apple;666609;Plus-5-10
Apple;666609;Minus1020
Apple;666609;Minus1020
Apple;666609;Plus-5-10
Pastry;666609;Plus-5-25
Pastry;666609;Plus-20-25
 
Upvote 0
The formula I had prior =SUMIF(A:B,A2,B:B), would add up the numbers correctly, but I still have the issue of having multiple sums for the same concate in use.
you have A:B

=SUMIF($A$2:$A$100,A2,$B$2:$B$100)

on your original example all the items in column A were different and so i was not sure what you needed to be SUMMED

Book1
ABCDE
1Concate in useValue to be AddedSUM
2Apple;666609;Plus-5-10-10
3Apple;666609;Minus102020
4Apple;666609;Minus102020
5Apple;666609;Plus-5-10-10
6Pastry;666609;Plus-5-25-25
7Pastry;666609;Plus-20-25-25
Sheet1
Cell Formulas
RangeFormula
E2:E7E2=SUMIF($A$2:$A$7,A2,$B$2:$B$7)
 
Upvote 0
Is this what you mean then?

22 09 22.xlsm
ABC
1Concate in useValue to be AddedSUM
2Apple;666609;Plus-5-10
3Apple;666609;Minus1020
4Apple;666609;Minus1020
5Apple;666609;Plus-5-10
6Pastry;666609;Plus-5-25
7Pastry;666609;Plus-20-25
SUMIF
Cell Formulas
RangeFormula
C2:C7C2=SUMIF(A$2:A$7,A2,B$2:B$7)
 
Upvote 0
Are you saying that you only want the sum to show up in the first instanace of each column A entry, like this:
Concate in useValue to be AddedSUM
Apple;666609;Plus
-5​
-10​
Apple;666609;Minus
10​
20​
Apple;666609;Minus
10​
Apple;666609;Plus
-5​
Pastry;666609;Plus
-5​
-25​
Pastry;666609;Plus
-20​

If so, then try this formula:
Excel Formula:
=IF(COUNTIF(A$2:A2,A2)=1,SUMIF(A:B,A2,B:B),"")
 
Upvote 0
Solution
you have A:B

=SUMIF($A$2:$A$100,A2,$B$2:$B$100)

on your original example all the items in column A were different and so i was not sure what you needed to be SUMMED

Book1
ABCDE
1Concate in useValue to be AddedSUM
2Apple;666609;Plus-5-10-10
3Apple;666609;Minus102020
4Apple;666609;Minus102020
5Apple;666609;Plus-5-10-10
6Pastry;666609;Plus-5-25-25
7Pastry;666609;Plus-20-25-25
Sheet1
Cell Formulas
RangeFormula
E2:E7E2=SUMIF($A$2:$A$7,A2,$B$2:$B$7)
Thank you for your reply! That's more of less what I was getting. I'm trying to further break it down. For example, there being only one -10 or one 20 instead of two. I'm just trying to make it easier to vlookup, because it seems to be erroring out on the Vlookup when I try to move it between sheets due to multiple values.
 
Upvote 0
can you give the example of what results you actually want
there being only one -10 or one 20 instead of two.
as you showed content in every row
I'm just trying to make it easier to vlookup,
How does vlookup come into it
Vlookup when I try to move it between sheets due to multiple values.
Again , explanation of multiple sheets and examples perhaps

I dont feel we have the full details
 
Upvote 0
because it seems to be erroring out on the Vlookup when I try to move it between sheets due to multiple values.
Having multiple rows the same should not cause VLOOKUP to error. I suspect something else is going wrong.

Edit: Seems like I am continually a minute or so slower than @etaf 😂
 
Upvote 0
Are you saying that you only want the sum to show up in the first instanace of each column A entry, like this:
Concate in useValue to be AddedSUM
Apple;666609;Plus
-5​
-10​
Apple;666609;Minus
10​
20​
Apple;666609;Minus
10​
Apple;666609;Plus
-5​
Pastry;666609;Plus
-5​
-25​
Pastry;666609;Plus
-20​

If so, then try this formula:
Excel Formula:
=IF(COUNTIF(A$2:A2,A2)=1,SUMIF(A:B,A2,B:B),"")
That's it! Thank you!
 
Upvote 0

Forum statistics

Threads
1,224,737
Messages
6,180,648
Members
452,992
Latest member
TokugawaIesuma

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