+ Reply to Thread
Results 1 to 2 of 2

How to Merge two arrays with filter condition?

  1. #1
    Registered User
    Join Date
    10-18-2021
    Location
    Belgium
    MS-Off Ver
    2019
    Posts
    1

    Question How to Merge two arrays with filter condition?

    Hi community!

    I am currently a student of VBA and we have a question by our professor, which nobody is able to solve. So this is why I would love to ask you all for help, I will copy the task below:

    -------

    We use the pseudo-code below to merge 2 datasets. Dataset 1 is already imported and will be store in the array v1(). Dataset 2 will be read and stored in the array v2().

    We want to merge the 2 datasets using a key variable, assuming that all values in the key variable are unique. The data is described below.
    Your task is to choose a position and insert the merge condition.

    Example: (1) If cat > dog

    Please respect the spacing after each symbol, and insert only the condition with no further keyword.

    The pseudo-code indicates only the main steps, other necessary steps might not be shown:

    [Import data to array v1]
    [Declare array v2]
    [Open data 2 file]
    [Open Do loop]
    Line = Split[Data row]
    d1 = Line(0)
    (1)
    [Convert d1 into date]
    (2)
    [For loop] with index k
    (3)
    Next
    (4)
    row = row + 1
    [Assign values to array v2]
    (5)
    [Close Do loop]
    (6)

    The array v1() stores the variables in the following order : dates(1), ticker(2), bid(3), ask(4), price(5), returns(6).
    The dataset 2 contains variables in the following order : dates(1), ticker(2), bid(3), ask(4), price(5), returns(6).
    We merge by using the key variable “ticker”


    -------


    Thanks a lot if you could help solve this problem!

    Best
    Pete DeBruy

  2. #2
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: How to Merge two arrays with filter condition?

    hello Belgium !
    I don't know what you want to do exactly and how your 2 datasets look like. An example would be better.
    I use dictionaries (https://excelmacromastery.com/vba-dictionary/) or sorted lists (https://excelmacromastery.com/vba-ar...comment-114919) for stuff like that.
    Afterwards you can copy it to an array.
    Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Matching cells value in two arrays, under specific condition
    By dargonaro in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-23-2021, 04:23 AM
  2. [SOLVED] How to Merge two arrays
    By Najwa_X in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-14-2020, 02:15 PM
  3. Replies: 1
    Last Post: 03-15-2009, 11:44 PM
  4. How to merge/join/append/concatenate VBA arrays
    By macyarab in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-03-2009, 04:21 AM
  5. [SOLVED] If condition is true return sumproduct of two arrays
    By Felipe in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-14-2005, 01:05 AM
  6. Using average in two condition arrays...
    By andyd2k in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 09-06-2005, 03:05 PM
  7. Looking for help with two condition arrays...
    By andyd2k in forum Excel General
    Replies: 5
    Last Post: 04-01-2005, 07:47 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