Okay! I think below would help you to reach to your goal:
>> Column1 = [:Q1,:Q1,:Q1,:Q2,:Q2,:Q3,:Q3,:Q3]
=> [:Q1, :Q1, :Q1, :Q2, :Q2, :Q3, :Q3, :Q3]
>> Column2 = [:A1,:A2,:A3,:A4,:A5,:A6,:A7,:A8]
=> [:A1, :A2, :A3, :A4, :A5, :A6, :A7, :A8]
>> h = Column1.each_with_object(Hash.new(0)){|i,ob| ob[i] = ob[i] + 1 }
=> {:Q1=>3, :Q2=>2, :Q3=>3}
>> enu = Column2.to_enum
=> #<Enumerator: [:A1, :A2, :A3, :A4, :A5, :A6, :A7, :A8]:each>
>> h1 = h.each_with_object(Hash.new([])){|(k,v),ob| v.times{ ob[k] = ob[k].dup.push(enu.next) } }
=> {:Q1=>[:A1, :A2, :A3], :Q2=>[:A4, :A5], :Q3=>[:A6, :A7, :A8]}
>> h1.each{|k,v| puts k,v}
Q1
A1
A2
A3
Q2
A4
A5
Q3
A6
A7
A8
=> {:Q1=>[:A1, :A2, :A3], :Q2=>[:A4, :A5], :Q3=>[:A6, :A7, :A8]}
Or you could do also as below:
a1 = [:Q1,:Q1,:Q1,:Q2,:Q2,:Q3,:Q3,:Q3]
a2 = [:A1,:A2,:A3,:A4,:A5,:A6,:A7,:A8]
a3 = a1.zip(a2).group_by{|i| i[0]}
a3.each{|k,v| v.flatten!.delete(k); puts [k,v]}