+ Reply to Thread
Results 1 to 8 of 8

VBA Script Assistance for Table Comparison by Row

  1. #1
    Registered User
    Join Date
    11-24-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    2

    VBA Script Assistance for Table Comparison by Row

    To All,

    First time poster and complete VBA Newbie.....so please be patience with me! I DO want to learn this, but I don't know where to start!!!!

    Here's what I've been asked to do in Excel using VBA:

    Take 2 separate tables, compare a string of data in 1st table, then bounce that information against a 2nd table and see if a certain condition exists. If it does then mark it in the 1st table, and then do the same for the rest of the data set in the first table. Note: Data Tables are dynamic from month-to-month with regards to the number of records/rows that need to be scrubbed.

    Below is the pseudo-code I've written

    The process is roughly as follows:

    Scan Table 1 - 'Requests for Work' by Person, Role, Project and Hours Requested, then
    Scan Table 2 - 'Availability' by Person, Role, and Hours Available, and see if either of the three conditions exist:
    If the person being requested has available hours in the month (using Table 1) as compared to table 2,
    Then, subtract those hours from the total monthly available hours and, then update the hours now left available for employee in a particular month, and mark Request as 'Satisfied', ELSE
    If the the person being requested is for 0 hours (for a particular project/month),
    Then mark row/field in Request Table as satisfied and move to the next request, ELSE
    If the person being request does NOT have the exact number of hours requested,
    Then, simply leave request row field where a 'Satisfied' response would typically go as a 'blank', or populate with 'unfilled' for that particular person,
    Then Step thru every other person in the Availability Table and determine If any other person with the same Role has the necessary available time
    Then, subtract those hours from the total monthly available hours and, then update the hours now left available for employee in a particular month, and mark Request as 'Satisfied'


    Go on to the next request


    At the end of this process all the requests should either have a 'Satisfied', or a blank label


    PLEASE NOTE: I am not expecting anyone here to write the code out for me, but rather give me guidance on how to best to proceed. I have a little bit of programming experience, but need some direction on how best to proceed.

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: VBA Script Assistance for Table Comparison by Row

    This sounds interesting.

    The first part:-

    checking for the named person availability. use
    Please Login or Register  to view this content.
    to find the exact name in your database
    then use
    Please Login or Register  to view this content.
    to check the hours available.

    If there is no match you have to select all people in the same role.

  3. #3
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: VBA Script Assistance for Table Comparison by Row

    This sounds interesting.

    The first part:-

    checking for the named person availability. use
    Please Login or Register  to view this content.
    to find the exact name in your database
    then use
    Please Login or Register  to view this content.
    to check the hours available.

    If there is no match you have to select all people in the same role.

    My post below shows how to select all people with the same row and to step through them:-

    http://www.excelforum.com/excel-prog...ml#post3487061


    This line:

    Please Login or Register  to view this content.
    can be modified to see how many hours that person has available.

    Please Login or Register  to view this content.
    I think I have given you enough information to make a start.


    NB:
    Please Login or Register  to view this content.
    Finds First blank in column A and assumes that is the bottom of your data.

    NB2:
    Please Login or Register  to view this content.
    Finds the row of the last cell and assumes that is the bottom of your data.
    Last edited by mehmetcik; 11-24-2013 at 02:03 PM.

  4. #4
    Registered User
    Join Date
    11-24-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: VBA Script Assistance for Table Comparison by Row

    Thanks Mehmetcik.....I am going to start looking over your suggestions. Like I said in my posting, I a total newbie with VBA and the difficulty I am having is simply trying to figure out where to start.....

  5. #5
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: VBA Script Assistance for Table Comparison by Row

    feel free to send private mesage for additional help

  6. #6
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: VBA Script Assistance for Table Comparison by Row

    Ok Iggy

    From your PMs you need a lot of help so I will build your solution in sections with explanations.

  7. #7
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: VBA Script Assistance for Table Comparison by Row

    Ok I have mocked up your tables
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: VBA Script Assistance for Table Comparison by Row

    The two name boxes and the list box work.

    enter mem into one and j in the other
    Attached Files Attached Files

+ 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. Assistance: Conditional formatting comparison between two FILES.
    By omni13 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-29-2013, 06:52 AM
  2. table results comparison
    By BlueHawaiian in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-27-2013, 12:56 PM
  3. Table Assistance
    By artikyulashun in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-21-2012, 06:13 PM
  4. Excel 2007 : Database creation - VB script assistance
    By plato_pup in forum Excel General
    Replies: 10
    Last Post: 09-13-2011, 04:17 AM
  5. [SOLVED] Pivot Table row comparison
    By revm2 in forum Excel General
    Replies: 2
    Last Post: 11-02-2005, 06:17 PM

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