Results 1 to 6 of 6

Multiplying and summing every nth range

Threaded View

  1. #1
    Registered User
    Join Date
    04-29-2013
    Location
    Wellington, New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    9

    Multiplying and summing every nth range

    Please help!

    I'm a newbie to all this and am struggling to write a function that will split a range into two and multiply the corresponding ranges together. I'm sorry the descritpion isn't any better but I don't know how better to explain it. Basically, I have this ugly formula being run at the moment:

    =B8*C8+D8*E8+F8*G8+H8*I8+J8*K8+L8*M8+N8*O8+P8*Q8+R8*S8+T8*U8+V8*W8+X8*Y8
    And attempted to write a new function (that isn't working) that looks like this:

    Function SumParallelColumn(range As range) As Integer
    
    Dim x As Integer
    
    Dim even As New Collection
    Dim odd As New Collection
    Dim sum As Integer
    
    sum = 0
    
    x = -1
    For Each cell In range
     x = x + 1
     If x Mod 2 = 0 Then
        even.Add CInt(cell.Value)
     Else
        odd.Add CInt(cell.Value)
     End If
    Next cell
    
    x = 0
    For x = 0 To even.Count
        MsgBox (even.Item(x))
    Next x
    SumParallelColumn = 53
    End Function

    Any help would be awesome and if I could provide any further information, just ask.

    Thanks!
    Last edited by skimp; 04-30-2013 at 04:55 PM.

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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