Forum Discussion
Scott255
Jun 22, 2023Copper Contributor
Fn to find all cells in a column with exactly same text, then sum adjacent cells of matches
I have a "database" of parts. For instance, Part number 001, 002, 003, 004, etc. The Part name (ex: 001) is in column A. Each Part number has a location column (column B), and a quantity Column (column C) as in how many I have of that part. I may have multiple entries (rows) for that part due to having that part stored on various shelves in various areas.
I want to have another column, Column D, that lists the overall qty on hand for each part. For instance, 001 is in 3 locations and therefore I have 3 rows where column A all contain "001". I want to know the total quantity of Column C for each matching part in my spreadsheet. The rows for each matching part number may or may not be adjacent, as I may add another location for a duplicate part number at the end of the spreadsheet, and forget to sort. I have looked at VLookup, Index, Match, Exact, etc functions but I can't figure out how to do this.
I am ok that Qty on hand (Column D) for each matched part number will be the same in each row.
Your help is appreciated. If you have a more efficient way of doing this, I would appreciate the input.
2 Replies
Sort By
- Patrick2788Silver Contributor
A PivotTable is probably most sensible but here's a formula solution:
=BYROW(Part,LAMBDA(row,IF(COUNTIF(TAKE(Part,ROW(row)-1),row)=1,SUMIF(Part,row,Qty),"")))
- Detlef_LewinSilver Contributor