+ Reply to Thread
Results 1 to 4 of 4

VBE help!!

  1. #1
    Registered User
    Join Date
    08-23-2007
    Posts
    7

    VBE help!!

    Hi guys!! I am new to VBE!! need some help..
    I have a big excel file.. A ranges sequentially from 1 to 5000. I am supposed to find the average of B for each A values and input into C as shown below

    A B C
    1 2 (2+2)/2
    1 2
    2 3 (3+3)/2
    2 3
    3 6 (6+2+1)/3
    3 2
    3 1
    4 9 (9+6)/2
    4 6

    I wanna do some thing like this

    for i=1:1:500
    Ci= AVERAGE((A1:A5000=i, B1:B5000))


    please help me if you noe VBE =) thanks!

  2. #2
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by corrilow
    Hi guys!! I am new to VBE!! need some help..
    I have a big excel file.. A ranges sequentially from 1 to 5000. I am supposed to find the average of B for each A values and input into C as shown below

    A B C
    1 2 (2+2)/2
    1 2
    2 3 (3+3)/2
    2 3
    3 6 (6+2+1)/3
    3 2
    3 1
    4 9 (9+6)/2
    4 6

    I wanna do some thing like this

    for i=1:1:500
    Ci= AVERAGE((A1:A5000=i, B1:B5000))


    please help me if you noe VBE =) thanks!
    Hi,

    why did you want to use VBA code?

    in C1 put

    =IF(COUNTIF(A$1:A1,A1)>1,"",SUMPRODUCT(--(A$1:A$5000=A1)*(B$1:B$5000))/COUNTIF(A$1:A$5000,A1))

    and formula fill that down the column, the result is shown against the first occurrance.

    hth
    ---
    Si fractum non sit, noli id reficere.

  3. #3
    Registered User
    Join Date
    08-23-2007
    Posts
    7
    Thanx Bryan!!!!!!!!
    It works great!! =)

  4. #4
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by corrilow
    Thanx Bryan!!!!!!!!
    It works great!! =)
    good to see, and thanks for your response.

    ---

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1