*-- Define private variables PRIVATE pnLoop, ; pnMaxVal, ; pnTotVal, ; plNumMatch pnLoop = 0 pnMaxVal = 0 pnTotVal = 0 plNumMatch = .f. *-- Declare the arrays DECLARE ArrNums[ 4, 4 ] DECLARE ArrRslt[ 4, 3 ] *-- Assign the numeric values to the ArrNums array ArrNums[ 1, 1 ] = 30 ArrNums[ 1, 2 ] = 30 ArrNums[ 2, 1 ] = 40 *-- and so forth, until all 16 are assigned *-- Scan the ArrNums array FOR pnLoop = 1 TO ALEN( ArrNums, 1 ) *-- Check for similarity between items *-- NOTE: YES, there is a better way to do this, *-- but this is simpler to cut and paste (BG) IF ArrNums[ pnLoop, 1 ] = ArrNums[ pnLoop, 2 ] OR ; ArrNums[ pnLoop, 1 ] = ArrNums[ pnLoop, 3 ] OR ; ArrNums[ pnLoop, 1 ] = ArrNums[ pnLoop, 4 ] OR ; ArrNums[ pnLoop, 2 ] = ArrNums[ pnLoop, 3 ] OR ; ArrNums[ pnLoop, 2 ] = ArrNums[ pnLoop, 4 ] OR ; ArrNums[ pnLoop, 3 ] = ArrNums[ pnLoop, 4 ] plNumMatch = .T. ENDIF && Check values of ArrNums *-- Determine the maximum value pnMaxVal = MAX( ArrNums[ pnLoop, 1 ], ; ArrNums[ pnLoop, 2 ], ; ArrNums[ pnLoop, 3 ], ; ArrNums[ pnLoop, 4 ] ; ) *-- Total the items pnTotVal = ArrNums[ pnLoop, 1 ] + ; ArrNums[ pnLoop, 2 ] + ; ArrNums[ pnLoop, 3 ] + ; ArrNums[ pnLoop, 4 ] *-- Write the values to the ArrRslt array ArrRslt[ pnLoop, 1 ] = plNumMatch ArrRslt[ pnLoop, 2 ] = pnMaxVal ArrRslt[ pnLoop, 3 ] = pnTotVal *-- Reset the private variables *-- to their default values plNumMatch = .f. pnMaxVal = 0 pnTotVal = 0 NEXT && pnLoop *-- The ArrRslt array now holds the values you desire *-- and you can check them/report on them however you want *** YOUR CODE GOES HERE *** *-- Clean up and return *-- NOTE: All array values will *DISAPPEAR* *-- when you RETURN unless: *-- 1) you store them *-- 2) you pass them back to the calling module *-- 3) you DECLARE the arrays -before- you call this module RETURNI'm certain that, after seeing this code, you can easily write the code you desire for the area marked *** YOUR CODE GOES HERE *** to further use the values you want.