From: botp Date: 2011-10-06T11:26:21+09:00 Subject: Re: comparing elements in same array On Thu, Oct 6, 2011 at 10:02 AM, Thomas Le wrote: > require 'roo' > ORGFILE = 'organize.xlsx' > xcel = Excelx.new("#{ORGFILE}") lose the inlining hash, just do xcel = Excelx.new(ORGFILE) same w others below.. > xcel.default_sheet = xcel.sheets.first > startingRow = 2 > nameArray = [] > nameProfile = Hash.new > startingRow.upto(xcel.last_row) do |row| >    name = xcel.cell(row,'A') >    location = xcel.cell(row,'B') >    nameProfile["#{name}"] = "#{location}" at this point, since you are associating the name to the location, you are assumming that the name is unique, ie each name has one and only one location. now what if you're wrong? >    nameArray.push("#{name}") >    startingRow += 1 > end hmm, finding duplicates names in nameArray is so obvious. why do you want it? to remove duplicate rows in your excel file? .... or maybe, you may also want to know duplicate names but different location, no? kind regards -botp