Skip to Content

How can I have different decimal places on different rows in a crosstab?

Crystal Reports 2011 and Crystal Report for Visual Studio 2010, service pack 4

I have a very simple table where each row represents a measurement M with a timestamp T, a value V, and the number of decimals to display D

For example, my table has:

M T V D M1 T1 V1 1 M1 T2 V2 1 M2 T1 V3 3 M2 T2 V4 3

My rows are the measurements, grouped by M, my colums are the timestamp T, my summarized field is Max of V1 so my crosstab looks like

Measurement\Timestamp T1 T2 M1 V1.nn V2.nn M2 V3.nn V4.nn

What I want is for V1 and V2 to be displayed as a number with one place past the decimal showing, e.g. V1.n and V2.n and for V3 and V4 I want three places after the decimal to be displayed, e.g. V3.nnn and V4.nnn:

Measurement\Timestamp T1 T2 M1 V1.n V2.n M2 V3.nnn V4.nnn

I know I can do this with a formula on the V's, but the problem with that is when I export to Excel the cells contain strings. I want them to be numbers.

Is there any way I can tell the cross-tab for format these things by row? I used the Format Field, Customized Number, then created a formula for the Decimals places, but it does not change based on the row.


Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Feb 27, 2013 at 05:52 PM


    What you are doing should work but it would depend on how your formula is finding the row.

    For Crosstabs, you have to use the GridRowColumnValue function to find the correct row.

    So your formatting formula would look something like:

    Select Case GridRowColumnValue("M")

    "M1" : ...

    "M2" : ...

    Default: ...;

    Or do an If statement like:

    If GridRowColumnValue("M") = "M1" Then


    Else If GridRowColumnValue("M") = "M2 Then


    Hope this helps,


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.