Consulting

Results 1 to 2 of 2

Thread: Pull from Table1,Table2, Test Data, Then place in Table3

  1. #1

    Pull from Table1,Table2, Test Data, Then place in Table3

    Hi All,
    So I'm new to vba, but have experience with other languages, and a lot of excel time under my belt. What I have below is basically a logic map that is obviously not written in VBA. The basic functionality I need is as follows:

    Pull from Data in Table1 (23 columns, I am interested in 8 of them) - Varying max rows
    Pull from Data in Table2 (23 columns, I am interested in 8 of them) - Varying max rows
    Run the comparisons below (all 1s are from table1 and 2s are from table2)
    Create Table 3 (2 columns called Predecessor and Successor)

    What we're doing here is seeing whether a "Cube" created by a 6 point location for one work statement, overlaps the "Cube" from another work statement.

    I am seriously struggling with how to create the below logic in VBA, any help would be appreciated, and let me know if you need more information.



    IF BBL_MIN1 > BBL_MAX1
    THEN
    REPLACE BBL_MIN1 WITH BBL_MAX1 AND BBL_MAX1 WITH BBL_MIN1 (PROBABLY HAVE TO STORE ONE IN A VARIABLE)
    END


    IF BBL_MIN2 > BBL_MAX2
    THEN
    REPLACE BBL_MIN2 WITH BBL_MAX2 AND BBL_MAX2 WITH BBL_MIN2 (PROBABLY HAVE TO STORE ONE IN A VARIABLE)
    END


    FOR EACH IP1 (FROM TABLE 1), TEST ALL OF IP2 ARRAY (FROM TABLE 2)


    IF


    ((WL_MAX1 <= WL_MAX2 AND WL_MAX1 >= WL_MIN2)
    OR
    (WL_MIN1 >= WL_MIN2 AND WL_MIN1 <= WL_MAX2)
    OR
    (WL_MIN1 <= WL_MIN2 AND WL_MAX1 >= WL_MAX2))


    AND


    ((STA_MAX1 <= STA_MAX2 AND STA_MAX1 >= STA_MIN2)
    OR
    (STA_MIN1 >= STA_MIN2 AND STA_MIN1 <= STA_MAX2)
    OR
    (STA_MIN1 <= STA_MIN2 AND STA_MAX1 >= STA_MAX2))


    AND


    ((BBL_MAX1 <= BBL_MAX2 AND BBL_MAX1 >= BBL_MIN2)
    OR
    (BBL_MIN1 >= BBL_MIN2 AND BBL_MIN1 <= BBL_MAX2)
    OR
    (BBL_MIN1 <= BBL_MIN2 AND BBL_MAX1 >= BBL_MAX2))


    THEN
    CREATE ROW (IN TABLE 3) WHERE PREDECESSOR COLUMN = IP2 AND SUCCESSOR COLUMN = IP1

  2. #2
    Moderator VBAX Wizard SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    6,988
    Location
    Bubbles, Maxi-Pads, IP Addresses, and Stadiums... Clear as mud

    have experience with other languages,
    But not English however, Visual BASIC (for Microsoft) Applications was written using English and actually is a variation of BASIC

    For a starter, your If... Thens can be replaced with
    BBL1_Min = Min(Data1, Data2)
    BBL1_Max = Max(Data1, Data2)


    We really need to understand the "physical" structure of your data. Which Columns? What Are their Headers? Their depth is inconsequential as long as all bottoms are the same. What does the Data look like?
    Last edited by SamT; 10-15-2019 at 07:31 PM.
    I always expect the student to do their homework and find all the errrors I leeve in.

    Please take the time to read the Forum FAQ

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •