MS Excel Custom Units

Posted on 2011-10-06
Last Modified: 2012-06-27

Im trying to make my custom units variable depending upon a value in a cell.

for example if cell A1 contains "W" (Watts) cells A2:A5 have "W" as their units. If A1 has "mW" or "kW" then A2:A5 should have units "mW" or "kW" respectively.

Question by:WTC_Services
    LVL 24

    Accepted Solution

    With code you could something like this in the sheet module so will change every time A1 is changed:
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$A$1" Then Range("A2:A5").NumberFormat = "@" & Target
    End Sub

    Open in new window


    Author Comment


    Do you know if there is any way to do this without code?

    LVL 85

    Assisted Solution

    by:Rory Archibald
    If you have Excel 2007 or later, you can apply number formats in conditional formatting, but you would have to create a rule for each format - you can't just have it append whatever is in A1.

    Author Closing Comment

    Thanks for the help guys!

    Featured Post

    Live: Real-Time Solutions, Start Here

    Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

    Join & Write a Comment

    This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
    Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
    The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
    The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now