Home > front end >  Counting all units aligned to an order number and returning the value
Counting all units aligned to an order number and returning the value

Time:08-12

I have a list of 25,000 orders. I want to find the total number of units in each order, and return that. Right now column A is the order number, and column B is the number of units broken down by line item as they were aligned to SKUs. So you will see order numbers repeat in column A based on how many SKUs were in that order. If there were 3 different SKUs ordered, such as in order 5, there will be three rows for order 5.

I want to write a function that checks column D for the order number, then searches column a for all the times that number is there and then sums the numbers aligned to that order in column B.

For example, cell D4 has order 3, and then searches column A for "3" and then finds and sums all the numbers in column B that are aligned to a "3" in column A. In this case that would return 47 as the answer.

I have been able to write a simple function to find that, but I wasn't able to increment it across all 25k orders.

enter image description here

  • Related