Find unique value in csv file

(imported topic written by SystemAdmin)

I have a csv file which contains a department and a username for each user. I want to create an analysis to search this csv file for it’s username and return the department. I need help searching the file for a unique username. Below is what I have:

CSV example:

Accounting,mpeterso1

IT-Services,mpeterso

Human Resources,jbaurer

Relevance

substrings before “,” of (lines containing “jbaurer” of file ((name of drive of system folder) & “\a.csv”))

This example will give me the output I am looking for, unless there are multiple results with that name (mpeterso) will return two results.

Is there a way I can search for an exact value of a line after “,” then output the results of that line?

(imported comment written by SystemAdmin)

You say you want to find a unique value, but then you mention cases where the value would not be unique.

If the username is not unique, what would you want to do in that instance?

  • Ignore any results that have more than one entry

  • Return a combined list of results found

  • Take the first result (perhaps with a “*” appended to note there is more than one entry)

(imported comment written by Doug_Coburn)

This should work:

preceding text of first “,” of (lines whose (following text of first “,” of it = “jbaurer”) of file ((name of drive of system folder) & “\a.csv”))

Doug