lookup then count values

Scarybuh

New Member
Joined
Nov 5, 2019
Messages
6
Good day,

I have an inventory in excel, that for each line in this sheet, it searches in another sheet for it and counts one
=COUNTIF(range, criterion)
=COUNTIF(Saidas!$A$2:$A$33,$A164)
So for example, I got the same code bars in diferent lines in the sheet Saidas the result here would be 3 for the barcode 111, and 1 for the barcodes 222 and 555.
111
222
111
555
111

What I want to improve now is getting the value next to it in another column and sum them,
111 5
222 3
111 10
555 8
111 5

I need a formula that searches for the 111 values and sums the values next to them, so for the 111 I would have 5+10+5 = 20
for the 222, I would have 3, and for 555 I would get the 8.
I tried the countifs and lookup but they don't do exactly what I'm looking for, the lookup would stop on the first result and throw me just the value 5.
Help would be appreciated, thanks.
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Hi Scarybuh,

If you just want totals next to each row then you can use SUMIF or SUMIFS.

If you want a list of distinct Numbers with their totals then create the distinct list (column E) then do the SUMIF (column F).

Book1
ABCDEF
1NumberValueSumDistinctSum 2
211152011120
3222332223
411110205558
555588 
6111520 
Sheet1
Cell Formulas
RangeFormula
F2:F4F2=SUMIF($A$2:$A$12,$E$2:$E$12,$B$2:$B$12)
C2:C6C2=SUMIF($A$2:$A$12,A2,$B$2:$B$12)
E2:E6E2=IFERROR(INDEX($A$2:$A$12, MATCH(0, INDEX(COUNTIF($E$1:E1, $A$2:$A$12),0,0), 0))&"", "")
 
Upvote 0

Forum statistics

Threads
1,215,028
Messages
6,122,749
Members
449,094
Latest member
dsharae57

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