Help with summation of different rows in 1 column

bassemjohn1

Board Regular
Joined
Jun 26, 2020
Messages
51
Office Version
  1. 2016
Platform
  1. Windows
Hello guys,

I am new here and am in need of your help,I have a report that is really taking a huge time
and all I need is a way to sum what's in column D (invoice amount) for each supplier and put it in in column F (under Diff)
for example
summation of Hertz invoice amount then Oriental and so on
is there any sum equation to sum the invoice amount numbers related to each supplier without me having to sum it manually
for each supplier knowing that the start and number of rows vary from supplier to another.

1593178923796.png
 
I had one more question please

is there a way i can copy this formula down across all suppliers in the sheet without manually doing it ? Cause i want the macro to identify it correctly
 
Upvote 0

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Do you mean you want a macro to insert the formula?
 
Upvote 0
Yes cause it’s not working with my macro, the macro can’t identify the sumifs formula i entered
 
Upvote 0
For future reference if you are looking for a macro, it's best to say so in the op. ;)
 
Upvote 0
How about
VBA Code:
Sub bassemjohn()
   With Range("F1", Range("F" & Rows.Count).End(xlUp))
      .Replace "Diff", True, xlWhole, , False, , False, False
      .SpecialCells(xlConstants, xlLogical).Offset(1).FormulaR1C1 = "=sumifs(c4,c1,rc1)"
      .Replace True, "Diff", xlWhole, , False, , False, False
   End With
End Sub
 
Upvote 0
How about
VBA Code:
Sub bassemjohn()
   With Range("F1", Range("F" & Rows.Count).End(xlUp))
      .Replace "Diff", True, xlWhole, , False, , False, False
      .SpecialCells(xlConstants, xlLogical).Offset(1).FormulaR1C1 = "=sumifs(c4,c1,rc1)"
      .Replace True, "Diff", xlWhole, , False, , False, False
   End With
End Sub
where should I add it ? by the end ?
 
Upvote 0
Just run that on it's own & it will put the formula onto the active sheet.
 
Upvote 0
In that case you don't have any cells in col F on the active sheet with the word "Diff"
Did you have the correct sheet visible when you ran the code?
 
Upvote 0

Forum statistics

Threads
1,214,534
Messages
6,120,086
Members
448,944
Latest member
sharmarick

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