Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8207499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:00:56+00:00 2026-06-07T09:00:56+00:00

I have a two dimensional table in Excel. eg. outputproduct blending combination **5 P1:0.6/P3:0.5**

  • 0

I have a two dimensional table in Excel. eg.

outputproduct      blending combination
**5                P1:0.6/P3:0.5**
  2                P1:0.3/P2:0.7
  4                P5:0.4/P2:0.7
  7                P11:0.7/P7:0.4

Suppose the range of the table varies from B2:C6 (it can vary). I have to create a function, whose first job is to read this range( which would be a user defined input) and then stores the data into a 2 dimensional array such that I could use the data(integer) in the first column and the string in the second column, appropriately.

The first column is the resultant product index, while the second column is the blending products in the given ratio, which combine together to give the product in the first column.

Then there is another table:

product index      current stock    updated stock
      **1**             **10**
        2                 20 
      **3**             **50**
        4                 15
      **5**             **100**
        .                 .
        .                 .
        .                 .

I have to update the stock amount in this table after the data processing.
For example, on combination of product 1 with product 3 in the ratio of 6:5 (units), 1 unit of product 5 is produced. So, I have to update the amount of stock for each of the products in table 2.

Any suggestions, how to convert the range into a 2 dimensional array?

Public Function Blending_function( R1 as Range, R2 as Range)
 ' R2 is the range of table 2, where the updating is to be done
 ' R1 is first stored in to a 2 dimensional array, such that the data in the
 ' column 1 could be read, and the data in the column 2 could be read (of table 1).
 ' the integer in the column 1 of table 1 refers to the product index in table 2.
 ' P(i) stands for the ith product. In first row of table-1, P1 and P3 combine in the 
 ' ratio of 6:5 to give P5. The current stock of each product is provide in table-2,
 ' whose range is R2(entire table 2).

 ' R1 is the range of table 1, from where the processing is to be done


End Function 

The main hurdle for me is to convert the range R1 (Table-1) into a 2 dimensional array. And then look from that array, the index of the output product, and locate that product in table-2 for updating the stock level.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T09:00:58+00:00Added an answer on June 7, 2026 at 9:00 am

    Here is an example on how to work with 2D array. The function will break up the blending combination and extract the values that you want so that you can use those.

    Sub Sample()
        Dim Rng1 As Range, Rng2 As Range
    
        On Error Resume Next
        Set Rng1 = Application.InputBox("Please select the Table1 Range", Type:=8)
        On Error GoTo 0
    
        If Rng1.Columns.Count <> 2 Then
            MsgBox "Please select a range which is 2 columns wide"
            Exit Sub
        End If
    
        On Error Resume Next
        Set Rng2 = Application.InputBox("Please select the Table2 Range", Type:=8)
        On Error GoTo 0
    
        If Rng2.Columns.Count <> 3 Then
            MsgBox "Please select a range which is 3 columns wide"
            Exit Sub
        End If
    
        Blending_function Rng1, Rng2
    
    End Sub
    
    Public Function Blending_function(R1 As Range, R2 As Range)
        Dim MyAr1 As Variant, MyAr2 As Variant
        Dim i As Long
        Dim blndCom As String, OutputPrd As String
        Dim ArP1() As String, ArP2() As String, tmpAr() As String
    
        MyAr1 = R1
    
        For i = 2 To UBound(MyAr1, 1)
            OutputPrd = MyAr1(i, 1)
            blndCom = MyAr1(i, 2)
            tmpAr = Split(blndCom, "/")
    
            ArP1 = Split(tmpAr(0), ":")
            ArP2 = Split(tmpAr(1), ":")
    
            Debug.Print OutputPrd
            Debug.Print Trim(ArP1(0))
            Debug.Print ArP1(1)
            Debug.Print ArP2(0)
            Debug.Print ArP2(1)
            Debug.Print "-------"
        Next
    End Function
    

    SNAPSHOT

    enter image description here

    Once you have these values you can use .Find to search for the product index in the range R2 and then use .Offset to enter your formula.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a two dimensional table with countries and years in Excel. eg. 1961
I have defined two dimensional array using following definition typedef std::vector<std::vector<short> > table_t; Can
I have a two-dimensional array (of Strings) which make up my data table (of
I have a two-dimensional array. When I print/dump this I get the following My
I have a two dimensional JSON array where each element contains several attributes. The
I have a two dimensional ArrayList that I need to filter the duplicates out
I have a two dimensional array with the following output Array ( [0] =>
I have a two dimensional array public class TwoDimensions { public static void main(String[]
I have the following as two ways to declare a two dimensional String array.
I have a database full of two-dimensional data - points on a map. Each

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.