How to return value from different column, different row, in the same table in Access Query

1ExcelNovice

New Member
Joined
Aug 24, 2012
Messages
24
Hello Access Pro's,

I have a query that uses a table linked to an excel file named Shipment Report. The format of the excel file is a little funky. I'm trying to match the Static Route (i.e., 8147_B01) with the Static Route Total(s) row associated with that route and return the Cost, Fuel Cost, Total Cost, Average Cost, and Stop Count (please see last example below). I'm still fairly new to Access and still have a lot to learn. Thank you for your help in advance!:)


Static RouteDelivery End DateTC Shipment IDCostFuel CostTotal CostAverage CostStop Count
8147_B0109/09/2013CS02117328273.0012.29285.29285.291
09/10/2013CS02121198273.0012.29285.29285.291
09/11/2013CS02125080273.0012.29285.29285.291
09/12/2013CS02128891273.0012.29285.29285.291
09/13/2013CS02132817273.0012.29285.29285.291
Static Route Total 1,365.0061.451,426.45285.295

<COLGROUP><COL style="WIDTH: 71pt" span=8 width=95><TBODY>
</TBODY>

I'd love for my query to return this information:

Static Route

<TBODY>
Cost</SPAN>Fuel Cost</SPAN>Total Cost</SPAN>Average Cost</SPAN>Stop Count</SPAN>
8147_B01</SPAN>Static Route Total</SPAN>1,365.00</SPAN>61.45</SPAN>1,426.45</SPAN>285.29</SPAN>5</SPAN>

</TBODY><COLGROUP><COL><COL><COL><COL><COL><COL><COL></COLGROUP>
</SPAN>
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
If you ensure that the Static Route is in every record in your source file, then you can run an aggregate query summing the values. Your table will need to look like this:

Static RouteDelivery End DateTC Shipment IDCostFuel CostTotal CostAverage CostStop Count
8147_B019/9/2013CS0211732827312.29285.29285.291
8147_B019/10/2013CS0212119827312.29285.29285.291
8147_B019/11/2013CS0212508027312.29285.29285.291
8147_B019/12/2013CS0212889127312.29285.29285.291
8147_B019/13/2013CS0213281727312.29285.29285.291

<colgroup><col span="2"><col span="6"></colgroup><tbody>
</tbody>
 
Last edited:
Upvote 0
Thanks guys, I failed to mention that it's not just a single instance. It's a series of batch records similar to that above. So I thought about having the query add the static route to each batch of records but there are 163 different static routes and I wasn't sure how to have it seperate them correctly. Also, some static routes do not have a total of 5 stop counts either which makes it a little trickier.

What I'm trying to do is find discrepancies with the Shipment Report by having a query compare it to a Master File. I only want to compare the totals but don't know how to assign the totals to the correct static routes since it is 5 places up on the linked report. Altering the linked report is not an option so I have to be able to manipulate it through Access.

Thanks again for all your help!
 
Upvote 0

Forum statistics

Threads
1,215,497
Messages
6,125,157
Members
449,208
Latest member
emmac

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