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:
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Provider[/TD]
[TD]Trip[/TD]
[TD]Date[/TD]
[TD]Time[/TD]
[TD]Price[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]X[/TD]
[TD]25/04/2014[/TD]
[TD]09:00[/TD]
[TD]15[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]X[/TD]
[TD]25/04/2014[/TD]
[TD]15:00[/TD]
[TD]20[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]X[/TD]
[TD]25/04/2014[/TD]
[TD]21:00[/TD]
[TD]18[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]Y[/TD]
[TD]25/04/2014[/TD]
[TD]07:00[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]Y[/TD]
[TD]25/04/2014[/TD]
[TD]12:00[/TD]
[TD]9[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]Y[/TD]
[TD]25/04/2014[/TD]
[TD]18:00[/TD]
[TD]7[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]X[/TD]
[TD]25/04/2014[/TD]
[TD]09:45[/TD]
[TD]16[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]X[/TD]
[TD]25/04/2014[/TD]
[TD]14:30[/TD]
[TD]19[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]X[/TD]
[TD]25/04/2014[/TD]
[TD]22:00[/TD]
[TD]20[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]Y[/TD]
[TD]25/04/2014[/TD]
[TD]08:00[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]Y[/TD]
[TD]25/04/2014[/TD]
[TD]13:30[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]Y[/TD]
[TD]25/04/2014[/TD]
[TD]17:45[/TD]
[TD]9[/TD]
[/TR]
</tbody>[/TABLE]
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:
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Trip[/TD]
[TD]Date[/TD]
[TD]Time[/TD]
[TD]Price A[/TD]
[TD]Price B[/TD]
[/TR]
[TR]
[TD]X[/TD]
[TD]25/04/2014[/TD]
[TD]09:00[/TD]
[TD]15[/TD]
[TD]16[/TD]
[/TR]
[TR]
[TD]X[/TD]
[TD]25/04/2014[/TD]
[TD]15:00[/TD]
[TD]20[/TD]
[TD]19[/TD]
[/TR]
[TR]
[TD]X[/TD]
[TD]25/04/2014[/TD]
[TD]21:00[/TD]
[TD]18[/TD]
[TD]20[/TD]
[/TR]
</tbody>[/TABLE]
* 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:
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Provider[/TD]
[TD]Trip[/TD]
[TD]Date[/TD]
[TD]Time[/TD]
[TD]Price[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]X[/TD]
[TD]25/04/2014[/TD]
[TD]09:00[/TD]
[TD]15[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]X[/TD]
[TD]25/04/2014[/TD]
[TD]15:00[/TD]
[TD]20[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]X[/TD]
[TD]25/04/2014[/TD]
[TD]21:00[/TD]
[TD]18[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]Y[/TD]
[TD]25/04/2014[/TD]
[TD]07:00[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]Y[/TD]
[TD]25/04/2014[/TD]
[TD]12:00[/TD]
[TD]9[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]Y[/TD]
[TD]25/04/2014[/TD]
[TD]18:00[/TD]
[TD]7[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]X[/TD]
[TD]25/04/2014[/TD]
[TD]09:45[/TD]
[TD]16[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]X[/TD]
[TD]25/04/2014[/TD]
[TD]14:30[/TD]
[TD]19[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]X[/TD]
[TD]25/04/2014[/TD]
[TD]22:00[/TD]
[TD]20[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]Y[/TD]
[TD]25/04/2014[/TD]
[TD]08:00[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]Y[/TD]
[TD]25/04/2014[/TD]
[TD]13:30[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]Y[/TD]
[TD]25/04/2014[/TD]
[TD]17:45[/TD]
[TD]9[/TD]
[/TR]
</tbody>[/TABLE]
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:
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Trip[/TD]
[TD]Date[/TD]
[TD]Time[/TD]
[TD]Price A[/TD]
[TD]Price B[/TD]
[/TR]
[TR]
[TD]X[/TD]
[TD]25/04/2014[/TD]
[TD]09:00[/TD]
[TD]15[/TD]
[TD]16[/TD]
[/TR]
[TR]
[TD]X[/TD]
[TD]25/04/2014[/TD]
[TD]15:00[/TD]
[TD]20[/TD]
[TD]19[/TD]
[/TR]
[TR]
[TD]X[/TD]
[TD]25/04/2014[/TD]
[TD]21:00[/TD]
[TD]18[/TD]
[TD]20[/TD]
[/TR]
</tbody>[/TABLE]
* 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.