Reformatting a query

deb

Active Member
Joined
Feb 1, 2003
Messages
400
Hello Access World,

I have data that looks like this, in the query(TTLDuration)

ChargeNoDDurMDurADur
abc123 9 4 22
def765 10 17 12

I need it to look like (for charting purposes)...

abc123 9 DDur
abc123 4 MDur
abc123 22 ADur
def765 10 DDur
def765 17 MDur
def765 12 ADur


Do you knw the easiest way to make this happen?

Thanks in advance!!
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Hi Deb,


First off the way you want to organize your data is how your table should be structured in the first place. I just making that point because sometimes people start off their tables like a spreadsheet with redundant column headings.

Having said that there may be other way to accomplish the task but I'll explain how I've done it in the past.

=====================================================

Take the query and make 3 new queries as follows.

In each query put the chargeNO field then each query put in these expressions in design view:

QTY:MDUR
Type:"MDUR"

*(I don't know what your fields represent so I have given them those names)

You do it for all 3 but only one of the types in each, you should get the following results:


ChargeNum qty Type
abc123 4 Mdur
def765 17 Mdur


ChargeNum Qty Type
abc123 22 Adur
def765 12 Adur

ChargeNum qty Type
abc123 9 ddur
def765 10 ddur



Now the rest is up to you how you want proceed. You can copy/paste all the records into a new table or set up append queries to move the data for you.

This will give you exactly what you need, like I suggested at the beginning your table should be structured this way to begin with.

Ziggy
 
Upvote 0
I know the data is organized goofy, but it is imported using ODBC from SAP. I just have to work with it the best I can...

I tried your suggestion and it works great.

Thank you for helping me sort out this pain...
 
Upvote 0

Forum statistics

Threads
1,221,567
Messages
6,160,540
Members
451,655
Latest member
rugubara

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