+ Reply to Thread
Results 1 to 6 of 6

Check for errors and correct them based on specific logic

  1. #1
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Check for errors and correct them based on specific logic

    Hello everyone
    In my attachment I explained the logic of correcting errors in sheets("Result") ..
    I need the desired results as in column C in Result sheet
    the logic may appear weird but it would be clear ..
    The idea of the file is to record presence and departure of emplyees ..some employees recorded twice so eveything would be ok as one time would be for presence time and the other for departure time.
    As for employees recorded once (see if presence time ,so the presence time should be recorded only .. and if the departure time recorded so the departure time should be recorded only)
    As for employees that don't exist in data would be empty in results
    As for employees recoreded three times or more should search for the first time for presence time and for the last time for departure

    Thanks advanced for help
    Attached Files Attached Files
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  2. #2
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Check for errors and correct them based on specific logic

    As for presence time should be before 8:31 and if else it is considered departure time
    Thanks a lot for this great forum

  3. #3
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Check for errors and correct them based on specific logic

    I appreciate any help in this topic..

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,814

    Re: Check for errors and correct them based on specific logic

    It's not a direct answer to the question you pose, but is it necessary to store the data on the "Data" tab in the current layout, or can you change this? As I look at your spreadsheet, I think that this would be much easier if the input data were arranged in a good database format -- 1 record per name, with several fields to enter and store the desired data.

    Then, everything on the second sheet becomes a simple lookup on the first sheet. VLOOKUP(name, table, mincolumn) to find the presence time. Similar for the departure time. Add appropriate checks for "blank" returns and such to account for those with 0 or 1 entry(ies) in the table.

    Is that a possibility, or are you being required by other constraints to process the data in this format?

    PS. I would have included a better description of the database table, but the forum's firewall did not want to allow html code for some reason to display the table format. I assume you know what a basic database should look like with records and fields.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  5. #5
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Check for errors and correct them based on specific logic

    Thank you very much MrShorty for this quick reply
    Your suggestion of changing the layout of sheet Data is great and almost solve the problem but the layout of Data sheet is fixed (I can't change it at all) ..
    So if there is a way to do it using vba .. I mean to change the layout of Data in indirect way .. by coping the original data and reconfigure it so as to be able to get desired results then at last delete the new created layout

  6. #6
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,814

    Re: Check for errors and correct them based on specific logic

    So if there is a way to do it using vba .. I mean to change the layout of Data in indirect way .. by coping the original data and reconfigure it so as to be able to get desired results then at last delete the new created layout
    Sure there are ways to rearrange the data, using VBA or whatever programming language you want. I expect you already have most of the skill in VBA needed to code this. A brute force kind of VBA algorithm would:

    1) Create a database sheet or assign a range for the database.
    2) read name in A2 of Data
    3) Check if name already has a record in database.
    3a) If no, then create a new record for name and write the time to the first empty time field for the new record.
    3b) If yes, then add time to the next empty time field for the existing name record.
    4) Go to the next name in Data and return to 2.
    5) Continue looping until end of file.

    Then, the checks on result are simple lookups after that.

    What part(s) of that do you get stuck on?

+ 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. Returning Specific values based on a check off sheet
    By Losguapos1 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 06-05-2015, 12:35 PM
  2. Check URL for specific path, return value based on that
    By Windsong in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-23-2015, 09:57 AM
  3. [SOLVED] Check cells are correct format and contain correct data
    By rikosborne in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-26-2014, 02:53 PM
  4. Check a webpage for specific text and highlight a cell based on result
    By ks100 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-12-2013, 09:56 AM
  5. Whats the correct VBA way to handle errors in a complex VBA Spreadsheets
    By nytrex in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-14-2013, 03:24 AM
  6. Conditional Formatting Logic Errors
    By traftacana in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 01-04-2013, 02:02 PM
  7. [SOLVED] I need help writing a macro that will correct typing errors?
    By notthemacroman in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-26-2006, 08:46 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