Results 1 to 1 of 1

HELP - Inputting ranged and listed values into formula!

Threaded View

HonestlyUgly HELP - Inputting ranged and... 02-23-2018, 08:27 AM
  1. #1
    Registered User
    Join Date
    02-17-2018
    Location
    United Kingdom
    MS-Off Ver
    2013
    Posts
    20

    HELP - Inputting ranged and listed values into formula!

    2 inputs, v and q, have a range of values determined by the set min, max and increment values in a worksheet. D and Fs are lists of inputs stated in columns (Fs is dependent upon D).
    I wish to bring in v and q incrementally, and also bring in D and FS in the order stated in the list.

    I.e if there were 3 and 5 values of v and q respectively, and 3 values of each D and Fs, there should be 45 outputs.


    Function valzArrayExp1(lMin As Double, lMax As Double, lInc As Double) As Variant
        
        Dim i As Long
        Dim TempArr As Variant
        
        ReDim TempArr(0 To (lMax - lMin) / lInc)
        
        For i = 0 To UBound(TempArr)
            TempArr(i) = lMin + lInc * i
        Next
          valzArrayExp1 = TempArr
        
    End Function
    Sub Test()
    
     Dim vValz, qValz, answers, v, q, inarr, d, Fs
        Dim k As Double
        Dim A As Double
        
        With Worksheets(1)
            A = .Range("C6")
            vValz = valzArrayExp1(.Range("F5"), .Range("F4"), .Range("F6"))
            qValz = valzArrayExp1(.Range("F17"), .Range("F16"), .Range("F18"))
        End With
        
        lastrow = Cells(Rows.Count, "P").End(xlUp).Row
        inarr = Range(Cells(1, 1), Cells(lastrow, 16))
        For i = 4 To lastrow
            d = inarr(i, 11)
            Fs = inarr(i, 39)
            
        ReDim answers(1 To (UBound(vValz) + 1) * (UBound(qValz) + 1) * UBound(inarr), 1 To 1)
        
        For Each d In inarr
            For Each v In vValz
                For Each q In qValz
                k = k + 1
                If d <> 0 Then answers(k, 1) = (v * A) / (d * q)
            Next d, v, q, Fs
        
        Range("AE4").Resize(UBound(answers, 1)) = answers
        
    End Sub
    Last edited by HonestlyUgly; 02-23-2018 at 08:36 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Help! IFS Formula with a ranged criteria?
    By DestynnieHall in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-29-2017, 05:11 PM
  2. [SOLVED] vba vlookup table values and compare to values listed in Column B
    By bqheng in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 10-26-2016, 08:34 AM
  3. [SOLVED] Exclude values that contain text from a named ranged vba
    By L plates in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-22-2015, 04:02 AM
  4. Replies: 4
    Last Post: 03-31-2015, 11:40 AM
  5. COUNTIFS to ignore FORMULA ranged cells
    By dluhut in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-22-2014, 05:00 PM
  6. Inputting rounded off values
    By jamie007 in forum Excel General
    Replies: 6
    Last Post: 03-18-2010, 08:59 AM
  7. Replies: 0
    Last Post: 08-25-2005, 02:17 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