Some ideas based on the original request - read a file (excel or other) and group the data by manager. First a simple example reading data from Excel and gathering it in a temporary file. This could also be done if the source is a CSV-type file.

The second example shows how to take that temporary data and create CSV files for each manager. You could use the xlLib to create new XLS files as well.

Glenn

 Code:
;Working with Excel, for example

; Define an Excel object pointer
$oXL = xlInstantiateApp()
 
; Open the file
xlFile($oXL, 0, 'MyFile.xls')
 
; Return an array of 4 values from the first data row
; Start with row 2, since row 1 has titles
; keep reading until a blank row is returned
$Row = 2
 
While $Row > 0
  $Range = 'A' + CStr($Row) + ':D' + CStr($Row)
  $aData = xlRangeValue($oXL, $Range, , 'Sheet1')
 
  ; The first element of the array contains the user, fourth has the manager
  ; Howard Bullok has a great Hash UDF that would work well here, but 
  ; I'm going to use a "poor-man's" hash - an INI file, and reduce the number
  ; of UDFs required
 
  If $aData[0] = ''
    ; Anti-Golf to make it clear what data goes where
    $User = $aData[0]
    $Manager = $aData[3]
    $Record = Join($aData, Chr(31))	; Chr(31) is ASCII US - Unit Separator
    $ = WriteProfileString('.\hash.ini', $Manager, $User, $Record)
  Else
    $Row = -1     ; no more data - exit the loop
  EndIf
 
  $Row = $Row + 1
Loop




You now have a file that looks like this, with the data from the spreadsheet:
 Code:
[MANA]
UserX=userX;UnitA;Paris;ManA
User11=user11;UnitBX;Madrid;ManA
userLA=userLA;UnitFM;Madrid;ManA
[MANC]
User01=user01;UnitRR;Paris;ManC
User05=user05;UnitRV;London;ManC
User12=user12;UnitZ;Paris;ManC


and so on...

This groups users by manager, with the extracted data. You can then use the EnumINI() UDF to first get an array of manager IDs, and then a list of users by manager.

Of course, you could read a text file, use Split(string, ';') to convert to an array and write to the hash file in pretty much the same way.
In the example below, use the CSV() UDF to output properly formatted CSV records.


 Code:
; Get list of Managers
$aManagers = EnumIni('.\hash.ini')
For Each $Manager in $aManagers
  ; get the list of users for the current manager ID
  $aUsers = EnumIni('.\hash.ini', $Manager)

  ; the print statements are only for debugging/monitoring
  ; Removing them can streamline the process by placing the RedirectOutput commands
  ; outside of the Users For/Next loop
  'Manager is ' $Manager ?
  For Each $User in $aUsers
    $User ?
    $aData = Split(ReadProfileString('.\hash.ini', $Manager, $User), Chr(31))
    ; the original data is now in $aData array
    ; simple result - write a CSV record to a MANAGER.CSV file
    $ = RedirectOutput('.\' + $Manager + '.csv')
    CSV($aData) ?
    $ = RedirectOutput('')

  Next ; User

Next ; Manager
_________________________
Actually I am a Rocket Scientist! \:D