# Hopefully my last range date question

**URL:** <https://www.ruby-forum.com/t/hopefully-my-last-range-date-question/113686>\
**Category:** Ruby\
**Created:** [September 3, 2007, 10:54pm UTC](https://www.ruby-forum.com/t/hopefully-my-last-range-date-question/113686 "2007-09-03T22:54:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dreamwave](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/7feea3/32.png) [@dreamwave](https://www.ruby-forum.com/u/dreamwave)\
**Post date:** [September 3, 2007, 10:54pm UTC](https://www.ruby-forum.com/t/hopefully-my-last-range-date-question/113686/1 "2007-09-03T22:54:14Z")

</div>

require ‘rubygems’  
require ‘ruport’  
require ‘ruport/util’  
require ‘date’  
require ‘optparse’

opts = OptionParser.new do |opts|  
opts.on("-h", “–help”, “Displays this help.”) do |a|  
puts opts  
end  
opts.on("-s", “–startdate”, “Determines what start date to use.”) do  
|b|  
@startdate = Date.new(\*ParseDate.parsedate(i)[0,3])  
end  
opts.on("-e", “–enddate”, “Determines what end date to use.”) do |c|  
@enddate = Date.new(\*ParseDate.parsedate(i)[0,3])  
end

#######

so the main line i want to focus on is  
@startdate = Date.new(\*ParseDate.parsedate(i)[0,3])

So ive grep’d the data out of the csv based on name. and along with  
these names comes the dates and the data.  
How would i go about making that @startdate match up with the grep data  
so that it

1. greps only those inputed dates for each name
2. how would i average the data for each date say if the column name  
were Number…IE:

Date Number Name  
4/23/07 1.43 Blah1

and if that date of 4/23 had multiple numbers in the Number column how  
would i average out all the numbers and have the average tied to that  
date?

Thanks again!
