Results 1 to 5 of 5

How to multiply two columns and get result in third range for a function

Threaded View

  1. #1
    Registered User
    Join Date
    09-02-2022
    Location
    Iceland
    MS-Off Ver
    MS 365 Enterprise
    Posts
    10

    Question How to multiply two columns and get result in third range for a function

    Hi everyone,
    I've searched far and wide but I'm not really getting what I'm doing wrong. This is a really simple procedure that I need to understand to make more complicated functions. I am not making a sub or using a designated column on a worksheet, this needs to be a function so it has to be range/variable based. I'm not an expert on VBA so I apologize for any mishandlings of correct terms, I'll try my best.

    What I want:
    Input:
    Column A: [3,4,8]
    Column B: [7,3,11]
    Output:
    Column C: [21,12,88]

    This is what I've been trying to use, and modifying to no avail:

    Function ExpectedReturn(ColumnA As Range, Column B As Range)
    Dim RangeColumnA As Variant
    RangeColumnA  = ColumnA 
    Dim RangeColumnB As Variant
    RangeColumnB = ColumnB
    For Each RangeColumnA In RangeColumnB
    RangeColumnA = RangeColumnA.Value * RangeColumnB.Value
    Next RangeColumnA
    End Function
    I need to have the result display in a range like the index function does and the range itself needs to be able to be variable (not limited to a place on the worksheet, like the range that is chosen for the function can be 1-2 variables or 150 +. Of course for this to work the ranges A and B need to be equally long.

    This would really further my understanding if I could work with ranges like this, thank you very much for reading
    Last edited by HappyExcelLife; 09-02-2022 at 10:35 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Trying to Multiply the result of an IF function combined with a VLOOKUP function
    By ucca in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 09-28-2018, 02:32 AM
  2. Replies: 4
    Last Post: 01-10-2014, 09:32 AM
  3. Replies: 4
    Last Post: 09-04-2013, 09:58 AM
  4. [SOLVED] VBA Multiply Function & Sub Procedure to Show Result
    By NeedForExcel in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-24-2013, 06:05 AM
  5. Replies: 4
    Last Post: 06-25-2012, 10:38 AM
  6. Multiply result of IF function in same cell
    By rockytop80 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-10-2012, 12:23 PM
  7. How to multiply 2 columns with variable range?
    By Wino in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-05-2009, 09:55 AM

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