Link to home
Start Free TrialLog in
Avatar of eklin
eklinFlag for United States of America

asked on

Crosstab or Pivot Table without numbers

I'm trying to create a crosstab query in MS Access that would show only character values instead of numbers as values.  The query is supposed to show a rating (e.g. H, M or L) as values for each risk (rows) and departments (columns).  The table driving this crosstab query doesn't have duplicate department/risk combination.  I haven't been able to do this with pivot tables/cross tab query because it only seem to allow numbers as values.  Any ideas?
Avatar of PatHartman
PatHartman
Flag of United States of America image

Convert the values to strings in the base query.  Then in the crosstab choose min/max/first/last to select the value to display.
If you only have a single record for each combination of row/column headers, then you should be able to use "first" or "last" as the aggregation method for the cells that go into the crosstab.

If you have multiple values and you need to perform some preliminary operation to determine the rating across multiple records before you create the crosstab.

It would be much easier to address your question if you could provide some sample data and how you want your output to look, with an explanation of how each cell in the crosstab was calculated.
Avatar of eklin

ASKER

Pat - what I'm trying to do is avoid substituting the character values to numbers and then back.  It's too messy.  I'm trying to do this in one query.

Dale - thanks for the tip.  I've attached the sample data and desired results in the attached spreadsheet.  I'm hoping there is a way to do this through a query instead of using VBA.  We had a consultant code this in VBA before.  She converted the characters (high/medium/low) to numbers and then back to perform the crosstab but performance wise it is taking over 8hrs to process 7,500 rows of records, where I can do this manually with Excel in less than 1 hr.  In Excel, you can choose 2 values for the columns and it works nicely because the columns can be displayed in the desired order if you choose that field first.
Sample-Crosstab.xlsx
ASKER CERTIFIED SOLUTION
Avatar of PatHartman
PatHartman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of eklin

ASKER

Pat,  this is just what I needed.  Thanks!
You're welcome.

PS - I used the wizard to build it.  Access has many useful wizards and this is one of them.  After I built the query, I switched to QBE view and removed the "totals" column since for a crosstab like this one it doesn't make sense given that there is nothing in the row to sum.  Although the wizard limits you to three columns as "Row Heading", you can modify the query after the wizard finishes to add more if you need them.  In your case we only needed one but I mention it because I want to make it clear that once the wizard is finished, the query is yours to modify.