Consulting

Results 1 to 4 of 4

Thread: Solved: Filling certain Cells

  1. #1
    VBAX Mentor
    Joined
    Aug 2011
    Posts
    353
    Location

    Solved: Filling certain Cells

    I know you all answered a previous question for me about autofilling select cells..but i have a variation of that question.

    Please see the attached document.

    Notice in column G, there are cusips and some of them are the same. In column AN, there are quantites. So in column AC, i would like to sum the block quantity for each cusip.

    So for example, for cusip 145681TR3, i would like to sum AN9+AN10+AN11.

    And do this for each cusip.


    You all gave me the formual =IF(A4"Block",Q3,R4) for a similar question..

    Could I turn this into saying =IF(G9 = "value in G9," then sum ANs and place in AC???
    Attached Files Attached Files

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,443
    Location
    Do you mean

    =SUMIF(G:G,G9,AN:AN)
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Mentor
    Joined
    Aug 2011
    Posts
    353
    Location
    Yes that works great, thanks!

  4. #4
    VBAX Mentor
    Joined
    Aug 2011
    Posts
    353
    Location
    Heres the code that works:

    [VBA]Sub Quantities()
    Dim lastrow As Long
    Dim i As Long
    With ActiveSheet

    lastrow = .Cells(.Rows.Count, "A").End(xlUp).Row
    For i = 9 To lastrow
    With .Cells(i, "AC").Select
    ActiveCell.FormulaR1C1 = "=SUMIF(C[-22],RC[-22],C[11])"

    End With

    Next i
    End With
    End Sub[/VBA]

    Thanks for the help!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •