Summing values based of adjacent value

RobertSi

New Member
Joined
Oct 15, 2015
Messages
4
Hi i have a table as follows and I would like to sum the values in column B based on the values in column A and place the answer in column D in order of column C. This is just an example of what i want the values are not 1, 2, 3 etc.

ABCD
1101
2502
3423
1824
134
275
360
420
230

<tbody>
</tbody>

I was thinking of using "for" statements but I'm unsure of whether that will actually work is there a way to do this?
I am using excel 2010 on windows 7. I am also a beginner when it comes to VBA.

Any help would be great thanks.
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Hi. Read up on SUMIF. In this case your range will be A2:A10, your criteria C1 and your sum range B2:B10. If you are going to drag down the formula you must absolute the range and sum range.
 
Upvote 0
Thanks the SUMIF helped I used it as such

For a = 2 To 100
If Sheets(ComboBox1.Text).Range("M" & a) <> Blank Then
Sheets(ComboBox1.Text).Range("O" & a) = Application.WorksheetFunction.SumIf(Sheets(ComboBox1.Text).Range("F:F"), Sheets(ComboBox1.Text).Range("M" & a), Sheets(ComboBox1.Text).Range("E:E"))
End If
Next

And I got the result i wanted
 
Upvote 0

Forum statistics

Threads
1,216,588
Messages
6,131,589
Members
449,657
Latest member
Timber5

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