ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   vba/macro for loop-based summing? (https://www.excelbanter.com/excel-programming/307397-vba-macro-loop-based-summing.html)

viveleroi0

vba/macro for loop-based summing?
 
Say I have three columns - column A is for a state code (AK, AL, etc
and column B is a hire date, and column C is a number of employee
hired in that state, on that date.

I want to find a way to perform the following type of calculation.
don't know VB but I think it needs to be coded - there is not an
function I am aware of.

ALL COLUMN B CELLS THAT MATCH OTHER COLUMN B CELLS
SUM COLUMN C
WRITE RESULT IN D1

thats kind of pseudo code, but it gets my point across. What I want i
something that groups all state codes, AK, AL, etc together and sums u
COLUMN C values for each unique state code

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

vba/macro for loop-based summing?
 
=SUMPRODUCT(--($B$1:$B$1000=B1),--($C$1:$C$1000))

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"viveleroi0 " wrote in message
...
Say I have three columns - column A is for a state code (AK, AL, etc)
and column B is a hire date, and column C is a number of employees
hired in that state, on that date.

I want to find a way to perform the following type of calculation. I
don't know VB but I think it needs to be coded - there is not any
function I am aware of.

ALL COLUMN B CELLS THAT MATCH OTHER COLUMN B CELLS
SUM COLUMN C
WRITE RESULT IN D1

thats kind of pseudo code, but it gets my point across. What I want is
something that groups all state codes, AK, AL, etc together and sums up
COLUMN C values for each unique state code.


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 07:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com