+ Reply to Thread
Results 1 to 8 of 8

Algorithm to code errors

  1. #1
    Registered User
    Join Date
    07-31-2008
    Location
    Manchester
    Posts
    4

    Smile Algorithm to code errors

    Hi,

    I'd like to know whether there's a way to develop an algorithm to code errors automatically using excel. The sheet attached shows what I've done by hand (see column F). If column D = 0 after the previous six responses have been 1, then F should be coded as a 'changeover' response (currently coded as ch, but can be numerical and recoded later if necessary.) If the responses immediately afterwards also = 0, then these should be coded as 'perseverative'. Responses that = 0 between changeover responses but not IMMEDIATELY after them should be coded as 'memory' errors. Any other errors (i.e. errors that occur before changeover responses) can be coded as 'other').

    If anyone has any ideas, I'd be very grateful,

    Thanks
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561
    Should F47 be ch or m?

  3. #3
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326
    I think "m" Charlie, sum of 1's is 5 not 6

  4. #4
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561
    If column D = 0 after the previous six responses have been 1
    I could have sworn that said 4 a minute ago! I think a truth table is in order?

  5. #5
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561
    Urk!

    =IF(D2=0,IF(ISERROR(INDIRECT("A"&ROW()-6)),"oth",IF(OR(I1="ch",I1="p"),"p",IF(COUNTIF(INDIRECT("D"&ROW()-6&":D"&ROW()-1),1)=6,"ch","p"))),"")

    oh no wait, I haven't put m in yet...
    Last edited by Cheeky Charlie; 09-25-2008 at 08:02 AM. Reason: not quite right

  6. #6
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561
    In Column F:

    =IF(D2=0,IF(OR(F1="ch",F1="p"),"p",IF(ISERROR(INDIRECT("A"&ROW()-6)),"oth",IF(COUNTIF(INDIRECT("D"&ROW()-6&":D"&ROW()-1),1)=6,"ch",IF(ISODD(COUNTIF(F$1:F1,"ch")),"m","oth")))),"")

    A UDF may be more appropriate.

    The above is for "alternating" changes, this is for "once changed - always active":

    =IF(D2=0,IF(OR(F1="ch",F1="p"),"p",IF(ISERROR(INDIRECT("A"&ROW()-6)),"oth",IF(COUNTIF(INDIRECT("D"&ROW()-6&":D"&ROW()-1),1)=6,"ch",IF(COUNTIF(F$1:F1,"ch")>0,"m","oth")))),"")

    I enjoyed that

    HTH

    edit(2):-
    Copy formula into D2 and copy down
    Last edited by Cheeky Charlie; 09-25-2008 at 09:13 AM. Reason: Second iteration & directions

  7. #7
    Registered User
    Join Date
    07-31-2008
    Location
    Manchester
    Posts
    4
    I have no idea what all that means, or what a UDF is (!) but thanks very much! I'll try and implement it now.

  8. #8
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326
    A UDF stands for User defined Function.
    It is a function created with VBA by a user, which afterwards can be used as a usual function in XL.
    If you click the functions button in the toolbar and select the "User defined" category you will find the UDF if any

+ 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. Code Execution Degrades Over Time
    By KDT in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-25-2008, 04:28 PM
  2. Placement of a particular line of code
    By smurray444 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-19-2007, 11:15 AM
  3. Running code while displaying a UserForm with vbModeless
    By PilgrimTim in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-06-2007, 08:08 AM
  4. Problems understanding automated emailing code.
    By DDONNI in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 01-19-2007, 12:26 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