Results 1 to 6 of 6

building arrays from cells and/or ranges

Threaded View

Leon V (AW) building arrays from cells... 08-05-2013, 07:03 AM
Debraj Roy Re: building arrays from... 08-05-2013, 07:12 AM
JosephP Re: building arrays from... 08-05-2013, 07:39 AM
Leon V (AW) Re: building arrays from... 08-06-2013, 05:09 AM
Debraj Roy Re: building arrays from... 08-05-2013, 08:16 AM
JosephP Re: building arrays from... 08-05-2013, 08:19 AM
  1. #1
    Forum Contributor
    Join Date
    06-22-2011
    Location
    somerset
    MS-Off Ver
    365
    Posts
    330

    building arrays from cells and/or ranges

    I have the following formula
    Public Function CofM(location As Range, mass As Range) As Variant
        Dim dbDivisor As Double
        dbDivisor = Application.Sum(mass)
        If Not dbDivisor = 0 Then
            CofM = Application.SumProduct(location, mass) / dbDivisor
        Else
            CofM = CVErr(xlErrDiv0)
        End If
    End Function
    which works fine when my inputs are =CofM(RangeA,RangeB)
    however I need it to also work with =CofM((cell1,cell2,cell3),(cell4,cell5,cell6))

    How do I get it to accept RangeA or cell1,cell2,cell3 or cell1,RangeA,cell2 as Array1?

    I have been trying to use =SumProduct((cell1,cell2,cell3),(cell4,cell5,cell6)) in varying forms to see if SumProduct can build an array from selected cells (similar to how Sum can be =Sum(range) or =Sum(num1,num2,num3)) with no luck so far.
    Last edited by Leon V (AW); 08-06-2013 at 05:12 AM. Reason: solved be Joseph

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Building macro to split out ranges
    By Culvernator in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-29-2011, 05:47 PM
  2. Replies: 0
    Last Post: 02-22-2011, 11:31 AM
  3. Building a Dynamic Chart using ranges in rs1 method
    By Dannypak in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 08-03-2010, 11:01 AM
  4. [SOLVED] limiting source ranges when building charts in vba
    By Benoit in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-21-2006, 02:55 PM
  5. Limiting ranges when building charts in vba
    By Benoit in forum Excel General
    Replies: 0
    Last Post: 03-20-2006, 07:10 PM

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