Statistic Reporting: Merge summary into 1 layout

Tumoz

Board Regular
Joined
Mar 9, 2015
Messages
68
I have a database where i search by specific criteria statistical reports. The last page of the report contains summary of the data.
My problem is that when I want to search for just colors "blue" and "red", Access report makes two summary for each of their own.

How do I search only for specific words, and that the statistics show this information in the same summary?

Example
I want to know how much blue and red i have in database.
In query i type in field Color criteria: Is like "Blue" Or Like "Red"

Summary sheet 1
Information 1332
Information 212
Red1
Blue0

<tbody>
</tbody>

Summary sheet 2
Information 1332
Information 212
Red0
Blue3

<tbody>
</tbody>

What i want
Information 1332
Information12
Red1
Blue3

<tbody>
</tbody>
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
All my data is on one (1) table, and this table is imported from excel.

When i'm using Query, in criteria Like "red" Or Like "blue", this gives me 2 rows of data in the "query preview" (when pressing RUN).
One row is for the red values, and the other is for blues.
Can i somehow merge these lines together?

Or i think i could fix this problem, if field contains text, it would choose this, and if this field is blank it would ignore it.
For some reason, when i tried this query was blank? :LOL:

Sorry for bad english
 
Upvote 0
can you copy the query and paste here
 
Upvote 0
CountOfLanguageLocationColorCountOfPhoneCountOfAddressCountOfPostal AddressCountOfMailCountOfGroup1CountOfGroup2CountOfGroup3CountOfRedCountOfBlueCountOfOrangeCountOfYellowCountOfGreenCountOfGreyCountOfGoldCountOfGroup11CountOfGroup12CountOfGroup13CountOfGroup14CountOfGroup15CountOfGroup16CountOfGroup17CountOfGroup18CountOfGroup19
3359LONDONRed13022187188917312191235915422359000000000000000
4718LONDONBlue8011615132411661622171810130171800000000000000

<tbody>
</tbody>

Location in query is GROUP BY
Criteria: Like "London"

Color is GROUP BY
Criteria: Like "Red" Or Like "Blue"

When i removed column Color from Query, it shows summary in same box, but it adds the rest of the color values into grand total.

summary_template.jpg
[/URL][/IMG]
 
Last edited:
Upvote 0
They Query, not the result, in the data source
 
Upvote 0
I made example file with less fields.

SELECT Count(ExampleMRExcel.Language) AS CountOfLanguage, ExampleMRExcel.Location, ExampleMRExcel.Color, Count(ExampleMRExcel.Phone) AS CountOfPhone, Count(ExampleMRExcel.Address) AS CountOfAddress, Count(ExampleMRExcel.Red) AS CountOfRed, Count(ExampleMRExcel.Blue) AS CountOfBlue, Count(ExampleMRExcel.Green) AS CountOfGreen, Count(ExampleMRExcel.Yellow) AS CountOfYellow
FROM ExampleMRExcel
GROUP BY ExampleMRExcel.Location, ExampleMRExcel.Color
HAVING (((ExampleMRExcel.Location) Like "London") AND ((ExampleMRExcel.Color) Like "Red" Or (ExampleMRExcel.Color) Like "Blue"));

Excel file below.
Colors in the end is just for grand total (e.g. how many reds there are)

LanguageLocation ColorPhoneAddressRedBlueGreenYellow
EnglishLondonRed45466kooRed
EnglishLondonRed555683pooRed
EnglishLondonBlue245eeeBlue
EnglishLondonBlue321wwwBlue
EnglishLondonBlue42qqqBlue
EnglishLondonRedrrrRed
ChinaLondonGreen5123fasGreen
ChinaLondonBlue424casBlue
ChinaLondonYellow2ewqYellow

<colgroup><col><col><col><col><col><col><col span="3"></colgroup><tbody>
</tbody>
 
Upvote 0
so you should be able to do
(Count(ExampleMRExcel.Blue) OR Count(ExampleMRExcel.Red)) AS CountOfBlue/Red

something like that (I think)
 
Upvote 0
so you should be able to do
(Count(ExampleMRExcel.Blue) OR Count(ExampleMRExcel.Red)) AS CountOfBlue/Red

something like that (I think)

How do i perform this? :ROFLMAO:

I tried fitting your line but I'm getting error "Characters found after end of SQL statement."
 
Upvote 0
Code:
SELECT 
Count(ExampleMRExcel.Language) AS CountOfLanguage
,  ExampleMRExcel.Location
, ExampleMRExcel.Color
,  Count(ExampleMRExcel.Phone) AS CountOfPhone
,  Count(ExampleMRExcel.Address) AS CountOfAddress
,  Count(ExampleMRExcel.Red) AS CountOfRed
, Count(ExampleMRExcel.Blue) AS  CountOfBlue
, Count(ExampleMRExcel.Green) AS CountOfGreen
,  Count(ExampleMRExcel.Yellow) AS CountOfYellow
FROM ExampleMRExcelGROUP BY ExampleMRExcel.Location
, ExampleMRExcel.Color
HAVING (((ExampleMRExcel.Location) Like "London") 
[B]AND  ((ExampleMRExcel.Color) Like "Red" Or (ExampleMRExcel.Color) Like  "Blue")[/B]);

I would have thought that was close, but I can't test it here, if thats what you have i can't see why yellow or green is being returned.

I don't know if HAVING can be substituted with WHERE
 
Upvote 0

Forum statistics

Threads
1,221,834
Messages
6,162,268
Members
451,758
Latest member
lmcquade91

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