The array formulas in E22:E24 are also powerful array formulas. The formula for E22 is =SUM(IF(A$2:A$19=$A22,D$2:D$19*E$2:E$19,0))

The code to enter these formulas follows. Although the formulas appear in the user interface in A1-style notation, you must use R1C1-style notation for entering array formulas:

Sub EnterArrayFormulas()

1 Add a formula to multiply unit price x quantity FinalRow = Cells(65536, 1).End(xlUp).Row

Cells(FinalRow + 1, 5).FormulaArray = "=SUM(R2C[-1]:R[-1]C[-1]*R2C:R[-1]C)" End Sub

0 0

Post a comment