+ Reply to Thread
Results 1 to 2 of 2

External data constantly updating, how do i retain a certain value??

  1. #1
    Registered User
    Join Date
    08-23-2006
    Posts
    3

    Cool External data constantly updating, how do i retain a certain value??

    I have an access control system which logs all card swipes into a microsoft access database. I have set up an Excel spreadsheet, which imports the following field data: date, swipe device (ie. door-in, door-out), surname and firstname., and updates the spreadsheet every 60 seconds.

    This works ok. However, on a seperate sheet within the spreadsheet, i have a list of employees. next to these, i want to display the current in or out status.

    I have created a string in the cell next to "fred bloggs'" name saying: if device=door-in and surname=bloggs and firstname=fred then cell content = "IN".

    or

    if device=door-out and surname=bloggs and firstname=fred then cell content="OUT".

    however, with the data sheet constantly updating, the above expressions only relates to the first row of data, and when a different person swipes in or out, the data moves down the sheet, and the new swipe data is inserted at the top, therefore the expresion is no longer valid.

    Therefore, what i am trying to do is, if device=door-in,name etc. cell content will stay as "IN" untill a "doorout statement appears" and only then will the cell content = "OUT"

    So how do i retain the data untill certain data appears?

    I would greatly appreciate somebody's help

    Many Thanks

    Steve

  2. #2
    Valued Forum Contributor Excelenator's Avatar
    Join Date
    07-25-2006
    Location
    Wantagh, NY
    Posts
    333
    This solution is based on the premise that the "Date" field has time as well. (ie 8/24/06 11:15:37 PM). If that is the case you could do the following:

    On the Data sheet create dynamic range names for Date, Swipe Device, surname, and first name. If your column headings are in row 1 you can use this formula in the refers to box in the range name dialog and adjust "A" for each column across.

    Offset(Sheet1!A2,0,0,CountA($A$:$A$)-1)

    Then on the summary sheet enter these formulas next to the names you want them to "summarize". Assuming the surname is in cell A1 and the first name is in cell B1 on the summary sheet enter this formula into cell C1

    ={MAX((Date)*(Surname=A1)*(FName=B1))}

    NOTE: this is an array formula. Do NOT enter the squiggly brackets. Enter the formula using CSE (Ctl-Shft-Enter) and excel will enter them for you.

    and then enter this formula into cell D1

    =IF(VLOOKUP(C1,Sheet1!$A$2:$B$4,2,FALSE)="Door Out","Out",IF(VLOOKUP(C1,Sheet1!$A$2:$B$4,2,FALSE)="Door In","In",""))
    ---------------------------------------------------
    ONLY APPLIES TO VBA RESPONSES WHERE APPROPRIATE
    To insert code into the VBE (Visual Basic Editor)
    1. Copy the code.
    2. Open workbook to paste code into.
    3. Right click any worksheet tab, select View Code
    4. VBE (Visual Basic Editor) opens to that sheets object
    5. You may change to another sheets object or the This Workbook object by double clicking it in the Project window
    6. In the blank space below the word "General" paste the copied code.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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