cellMatrix.net
Spreadsheet Modeling and Related Topics

About

Formulas, Charts, and Models Created with Microsoft Excel.
More . . .

Statistics

  • Total Entries - 102
  • Current Viewers - 13

Categories

Recent Comments

Syndicate

Validate

Proportional Axis Calculations - Unit Conversions

A recent post to the Microsoft Excel Charting Discussion Group asks "how can I show pounds on the primary axis and kilograms on the secondary axis with tick marks that correspond to each other?" I'm thinking the chart should look something like the one below:

image

The solution requires calculating a primary and secondary axis that are proportional to each other. The illustration below shows those calculations:

image

Finally, I've found that the VBA procedure below is the easiest and most accurate method to set each axis. Add the procedure to a regular module, select the chart, and run the macro to set the axis.

Sub SetAxis()
    ActiveChart.Axes(xlValue).Select
    With ActiveChart.Axes(xlValue)
        .MaximumScale = Range("C26").Value
        .MinimumScale = Range("C28").Value
        .MajorUnit = Range("C29").Value
    End With
    ActiveChart.Axes(xlValue, xlSecondary).Select
    With ActiveChart.Axes(xlValue, xlSecondary)
        .MaximumScale = Range("D26").Value
        .MinimumScale = Range("D28").Value
        .MajorUnit = Range("D29").Value
    End With
    ActiveChart.Deselect
End Sub

Reference: The macro above is a variation of a procedure described at the Peltier Technical Services web site.

You end up with four series when you really only want to show two. At this point double-click on a series. In the Format Data Series dialog box, you can hide two of the four series via the Patterns tab.




Comment Form

Name: (Required)
E-Mail Address: (Optional)
Location: (Optional)
Web Site Address: (Optional)

Remember my personal information?
Notify me of follow-up comments?

Before submitting your comment, please enter the phrase you see below: