Find all possible paths between any two nodes in a bi-directional route map

sks4444

New Member
Joined
Jul 26, 2018
Messages
3
requesting for the vba program for finding all possible paths between any two nodes in a bi-directional route map. inpit is given in sheet 1 as a=from; B=to; C=distance, d= time; e= fare.
output is given in sheet 2 as
A1=from ....;
B1= to ....;
A2= possible path1; B2 = DISTANCE C2= TIME TAKEN D2 = TOTAL FARE
A3 = possible path 2; B3 = DISTANCE C3= TIME TAKEN D3 = TOTAL FARE
A4=possible path 3; B4 = DISTANCE C4= TIME TAKEN D4 = TOTAL FARE
A5=possible path 4; B5 = DISTANCE C5= TIME TAKEN D5 = TOTAL FARE
A6=possible path 5; B6 = DISTANCE C6= TIME TAKEN D6 = TOTAL FARE


AS DATA

[TABLE="width: 271"]
<colgroup><col><col><col><col><col><col></colgroup><tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]FROM[/TD]
[TD]TO[/TD]
[TD]DISTANCE[/TD]
[TD]TIME[/TD]
[TD]AMOUNT[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]200[/TD]
[TD]00:02:30[/TD]
[TD]11[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]195[/TD]
[TD]00:03:30[/TD]
[TD]12[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]210[/TD]
[TD]00:04:30[/TD]
[TD]13[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]180[/TD]
[TD]00:05:30[/TD]
[TD]14[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]245[/TD]
[TD]00:06:30[/TD]
[TD]15[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]230[/TD]
[TD]00:07:30[/TD]
[TD]16[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]C[/TD]
[TD]G[/TD]
[TD]215[/TD]
[TD]00:08:30[/TD]
[TD]17[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]F[/TD]
[TD]H[/TD]
[TD]150[/TD]
[TD]00:09:30[/TD]
[TD]18[/TD]
[/TR]
</tbody>[/TABLE]


Input
FROM B
TO H
SOLVE WITH NEW
OUTPUT

[TABLE="width: 759"]
<colgroup><col width="69" span="11" style="width:52pt"> </colgroup><tbody>[TR]
[TD="class: xl65, width: 69"]from[/TD]
[TD="class: xl65, width: 69"]to[/TD]
[TD="class: xl65, width: 69"][/TD]
[TD="class: xl65, width: 69"][/TD]
[TD="class: xl65, width: 69"][/TD]
[TD="class: xl65, width: 69"][/TD]
[TD="class: xl65, width: 69"][/TD]
[TD="class: xl65, width: 69"][/TD]
[TD="class: xl65, width: 69"]DISTANCE[/TD]
[TD="class: xl65, width: 69"] TIME[/TD]
[TD="class: xl65, width: 69"] AMOUNT[/TD]
[/TR]
[TR]
[TD="class: xl65"]B[/TD]
[TD="class: xl65"]H[/TD]
[TD="class: xl66"]B[/TD]
[TD="class: xl66"]C[/TD]
[TD="class: xl66"]D[/TD]
[TD="class: xl66"]E[/TD]
[TD="class: xl66"]F[/TD]
[TD="class: xl66"]H[/TD]
[TD="class: xl66"]980[/TD]
[TD="class: xl67"]00:29:30[/TD]
[TD="class: xl68"] 72[/TD]
[/TR]
[TR]
[TD="class: xl65"][/TD]
[TD="class: xl65"][/TD]
[TD="class: xl66"]B[/TD]
[TD="class: xl66"]C[/TD]
[TD="class: xl66"]G[/TD]
[TD="class: xl66"]F[/TD]
[TD="class: xl66"]H[/TD]
[TD="class: xl66"] [/TD]
[TD="class: xl66"]790[/TD]
[TD="class: xl67"]00:29:00[/TD]
[TD="class: xl68"] 63[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top