ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Formatting Numeric Fields from Within MS Query (https://www.excelbanter.com/excel-discussion-misc-queries/173420-formatting-numeric-fields-within-ms-query.html)

Paul D. Simon

Formatting Numeric Fields from Within MS Query
 
I have an Excel database which contains one numeric column named
Price. That Price column is formatted as "#,##0". In other words, no
decimal places.

Drilling down through the Data menu, I run the MS Query Wizard, and on
the last screen, I choose "View data or edit query in Microsoft
Query". This shows me a Data Grid (similar to that in Access) where I
can also open a Query Grid.

The Problem I'm having is that even though the Price field in the
worksheet shows no decimal places, the numbers display with 1 decimal
place in the data grid in the MS Query screen. For example the number
28 in the worksheet displays as 28.0 in the data grid in MS Query.

I can't find anything in the MS Query Help screens to indicate how I
can format that field to no decimal places either from within the data
grid or from the query grid.

I've tried creating a new field in the data grid using
"Format(Price,"#,##0")" but I get an error message. Is there a way I
can format numbers from within MS Query?

CLR

Formatting Numeric Fields from Within MS Query
 
I always create my MSQueries with my Excel Macro Recorder turned on, and then
fire the macro to run the Query whenever I want. This allows me to edit the
macro and perform whatever formatting I wish.........very handy.

Vaya con Dios,
Chuck, CABGx3



"Paul D. Simon" wrote:

I have an Excel database which contains one numeric column named
Price. That Price column is formatted as "#,##0". In other words, no
decimal places.

Drilling down through the Data menu, I run the MS Query Wizard, and on
the last screen, I choose "View data or edit query in Microsoft
Query". This shows me a Data Grid (similar to that in Access) where I
can also open a Query Grid.

The Problem I'm having is that even though the Price field in the
worksheet shows no decimal places, the numbers display with 1 decimal
place in the data grid in the MS Query screen. For example the number
28 in the worksheet displays as 28.0 in the data grid in MS Query.

I can't find anything in the MS Query Help screens to indicate how I
can format that field to no decimal places either from within the data
grid or from the query grid.

I've tried creating a new field in the data grid using
"Format(Price,"#,##0")" but I get an error message. Is there a way I
can format numbers from within MS Query?



All times are GMT +1. The time now is 08:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com