View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
EricG EricG is offline
external usenet poster
 
Posts: 220
Default 2 loops? got me spinning

Probably don't need VBA for this. Type this formula into an empty next to
column D and drag down. Should do the summing you want for each state:

=SUMIF(Data!D2:D100,States!C2,Data!Z2:Z100)

Adjust the formula to suit your data and columns, then drag down to sum all
50 states.

HTH,

Eric

"John" wrote:

I have States in column D and a percentage in column Z (on Data sheet). I
would like to loop through rows in the sheet and sum column Z for each state
in column D. The list of States is on worksheet States and column C.

For example... TX may show up twice on Data sheet and would like a sum for
the number in column Z for Texas. Can I put that total on the States sheet
in column D next to the state abbreviation?

Any help is appreciated