Help with summation of different rows in 1 column

bassemjohn1

New Member
Joined
Jun 26, 2020
Messages
16
Office Version
2016
Platform
Windows
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
 

Some videos you may like

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
41,201
Office Version
365
Platform
Windows
Do you mean you want a macro to insert the formula?
 

bassemjohn1

New Member
Joined
Jun 26, 2020
Messages
16
Office Version
2016
Platform
Windows
Yes cause it’s not working with my macro, the macro can’t identify the sumifs formula i entered
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
41,201
Office Version
365
Platform
Windows
For future reference if you are looking for a macro, it's best to say so in the op. ;)
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
41,201
Office Version
365
Platform
Windows
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
 

bassemjohn1

New Member
Joined
Jun 26, 2020
Messages
16
Office Version
2016
Platform
Windows
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 ?
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
41,201
Office Version
365
Platform
Windows
Just run that on it's own & it will put the formula onto the active sheet.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
41,201
Office Version
365
Platform
Windows
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?
 

Watch MrExcel Video

Forum statistics

Threads
1,100,040
Messages
5,472,127
Members
406,805
Latest member
AlesD6

This Week's Hot Topics

Top