Consulting

Results 1 to 6 of 6

Thread: Getting Key value from last occurrence of another table

  1. #1
    VBAX Newbie
    Joined
    Jun 2020
    Posts
    4
    Location

    Getting Key value from last occurrence of another table

    Hi,
    Im fairly very new to VBA Scripting. i have a problem please find the below table
    Output column is Comments

    Name Comments
    Alert A1
    Phone P2
    Email Not started


    The comment column gets the value from the below table
    Name subname value
    Alert A1
    1​
    Alert A2
    0​
    Alert A3
    0​
    Phone P1
    1​
    Phone P2
    1​
    Phone P3
    0​
    Phone P4
    0​
    Email E1
    0​
    Email E2
    0​
    Email E3
    0​



    from first table it should look for the value in second table and check the value column for the last occurrence of 1 say in Alerts A1 is the last has 1 then A1 has to appear in the comment column in table 1, if all three are of alerts are done then its Comments is "Done".

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,272
    Location
    Don't understand that last paragraph at all. I cannot see why Alert is A2 but Phone is P2, and Email is Not Started. Why not A1, P1, and E1?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3

  4. #4
    VBAX Newbie
    Joined
    Jun 2020
    Posts
    4
    Location
    Consider like this table 1 is the main table, for each value in table 1 names has multiple sub names in Table 2. the output is to get the Table 1 comment value from table 2 where the last occurrence of 1,
    so for Alerts referencing to table 2 the 1 has stopped at A1
    For Phone referencing to table 2 the 1 has stopped at P2, When p3 value in table 2 is changed to 1 the table 1 comment is changed to p3.
    If all 5 are 1 then the comment should be Done.
    Hope that clarifies.

  5. #5
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,272
    Location
    Why do you want to do it in VBA, why not a formula?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  6. #6
    VBAX Newbie
    Joined
    Jun 2020
    Posts
    4
    Location
    hmm, im open to that too.

Tags for this Thread

Posting Permissions

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