Hello All, this is my first post, so apologies if I come across noob-ish!
What I am trying to do is compare 'Prices' between different 'Providers' for 'Trips' that they all run/operate - Public Transport for instance. The raw data might look something like this if simplified:
<tbody>
</tbody>
I want to compare prices between 'Providers' side by side for the same 'Trip' running on the same 'Date' and 'Time.' The problem I have is that all Providers do not always operate at the same Time, so I want to compare the Price for the closest possible time in this case - larger, smaller or even when they are the same. This rules out 'Approximate Vlookups' which is a shame.
I want the comparison table, in a separate sheet, to look like this, using the timetable for Provider A:
<tbody>
</tbody>
* Is using formulas the best way to achieve this? Please let me know - I have very-basic VBA skills.
I can fill the Price A column quite easily using a 'Sumifs' formula. But I'm having real trouble filling column Price B with the correct data.
I've been trying to use Vlookups and Index-Match formulas to fill column Price B using the raw data but haven't had much luck. I know how to find the closest possible time match using:
{=INDEX(return_range,MATCH(MIN(ABS(time_range - Time)),ABS(time_range - Time),0)}
But I don't know how to include conditions to ensure that Trip and Date values are exactly the same for both Providers A and B. I've tried to combine the above formula with an If statement like so:
{=INDEX(IF(test,return_range),MATCH(MIN(ABS(time_range - Time)),ABS(time_range - Time),0)}
But cannot get it to work correctly. Is there an alternative to this formula?
Any help would be greatly appreciated!
Thanks.
What I am trying to do is compare 'Prices' between different 'Providers' for 'Trips' that they all run/operate - Public Transport for instance. The raw data might look something like this if simplified:
Provider | Trip | Date | Time | Price |
A | X | 25/04/2014 | 09:00 | 15 |
A | X | 25/04/2014 | 15:00 | 20 |
A | X | 25/04/2014 | 21:00 | 18 |
A | Y | 25/04/2014 | 07:00 | 6 |
A | Y | 25/04/2014 | 12:00 | 9 |
A | Y | 25/04/2014 | 18:00 | 7 |
B | X | 25/04/2014 | 09:45 | 16 |
B | X | 25/04/2014 | 14:30 | 19 |
B | X | 25/04/2014 | 22:00 | 20 |
B | Y | 25/04/2014 | 08:00 | 8 |
B | Y | 25/04/2014 | 13:30 | 6 |
B | Y | 25/04/2014 | 17:45 | 9 |
<tbody>
</tbody>
I want to compare prices between 'Providers' side by side for the same 'Trip' running on the same 'Date' and 'Time.' The problem I have is that all Providers do not always operate at the same Time, so I want to compare the Price for the closest possible time in this case - larger, smaller or even when they are the same. This rules out 'Approximate Vlookups' which is a shame.
I want the comparison table, in a separate sheet, to look like this, using the timetable for Provider A:
Trip | Date | Time | Price A | Price B |
X | 25/04/2014 | 09:00 | 15 | 16 |
X | 25/04/2014 | 15:00 | 20 | 19 |
X | 25/04/2014 | 21:00 | 18 | 20 |
<tbody>
</tbody>
* Is using formulas the best way to achieve this? Please let me know - I have very-basic VBA skills.
I can fill the Price A column quite easily using a 'Sumifs' formula. But I'm having real trouble filling column Price B with the correct data.
I've been trying to use Vlookups and Index-Match formulas to fill column Price B using the raw data but haven't had much luck. I know how to find the closest possible time match using:
{=INDEX(return_range,MATCH(MIN(ABS(time_range - Time)),ABS(time_range - Time),0)}
But I don't know how to include conditions to ensure that Trip and Date values are exactly the same for both Providers A and B. I've tried to combine the above formula with an If statement like so:
{=INDEX(IF(test,return_range),MATCH(MIN(ABS(time_range - Time)),ABS(time_range - Time),0)}
But cannot get it to work correctly. Is there an alternative to this formula?
Any help would be greatly appreciated!
Thanks.