# Posts by sobi_256

thankyou so much, my loop 2, any idea what i was doing wrong, because it was calculating the first cell (d2) right but td3 and so on were not the sums.
thankyou again

Hello

i am attaching my file. Loop 1 doesnt work at all (the results should be in column). Loop2 only works for d2 put it doesnt add for d3 and downwards.

thanyou so much
[ATTACH]n1214023[/ATTACH]

## Files

• TESTFIB.xlsm

Hello

my columns starting from G has inventory in rows. For example
column G is
nails
300
230
450

cholumn H is
screws
40
50
30

Now in column A
I HAVE
nails
screws
in column C i will have the addition
980
120.
I am trying to write a macro to do that

but this is a problem "=SUM(C[i])"
if i subsitute i with a number like 5( column 5 ) then it works but then down the C column will have same values
because the outcome what i want in column C is
=SUM(H:H)
=SUM(I:I)
=SUM(J:J)

Thankyou so much

thankyou so much.
it is working.
i will be very grateful If u can elaborate or point out what i was doing wrong. i still need to learn how to write code concisely and neatly

thanks again

I am trying to write a macro for this but i am failing Dim lLastRow As Long
With Worksheets("Stocks")
lLastRow = .Range("A" & .Rows.Count).End(xlUp).Row
End With

Range("AB4:AB" & lLastRow).FormulaR1C1 = "=SUMPRODUCT(R4C1:R" & lLastRow & "C1=R[-2]C9)*(R4C2:R" & lLastRow & "C2>=30)*(R4C2:R" & lLastRow & "C2))"

any help would be appreciated

Thankyou so much for the reply
i tried your code but i am facing some problems (please see attached file)
Further my rows in column a AND b will change each day (for example more entries will be added) i want a macro that does sumif . Please see the below file
[ATTACH]n1212864[/ATTACH]

## Files

• excel.xlsm

Hello

I have two columns A and B which are following

column A column B
Asphalt 30
Asphalt 60
Aubery 20
Aubery 35
Aubery 60
Blue 20
Blue 65
Blue 85

i want my out put to be adding whose values are greater than 30 so that my output looks the following

column I column J
Asphalt 60
Aubery 95
Blue 150

I need a macro that can do this.

Thankyou so much
Regards