+ Reply to Thread
Results 1 to 3 of 3

Number format based on cell value

  1. #1
    Registered User
    Join Date
    02-25-2015
    Location
    Sweden
    MS-Off Ver
    2013
    Posts
    2

    Number format based on cell value

    Hi guys,

    I've have run into som trouble when trying to sum number with different values. As you can se on the picture below, it doesnt differentiate between Dates and numbers.
    Im trying to figure out if it's possible to change the number formatting automatically based on a cell value.
    For example if the unit is "Days" I want the number formatting to be Date and if the unit is "hrs" the number formatting to "number"

    Untitled.png
    Attached Files Attached Files
    Last edited by Svedan; 02-25-2015 at 08:01 AM.

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,156

    Re: Number format based on cell value

    hi Svedan. try conditional formatting. format the whole column G as General first.
    select the range you want to apply to (say from G2:G10 for eg)
    go to Home -> Conditional Formatting -> New Rule -> Use a formula to determine which cells to format -> Format values where this formula is true:
    =$F2="Days"

    go to Format -> Number tab -> Select the date format you desire. if it's not "Days", it will show as General. that will be for the hours.

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Registered User
    Join Date
    02-25-2015
    Location
    Sweden
    MS-Off Ver
    2013
    Posts
    2

    Re: Number format based on cell value

    hi Benishiryo, your soultion works great, thank you for your help!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 07-23-2013, 07:20 PM
  2. Replies: 1
    Last Post: 07-18-2013, 10:11 AM
  3. [SOLVED] Excel VBA/Macro - Copy Number of Rows based on the number in a cell to another sheet
    By diane.alexander58 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-15-2012, 11:32 AM
  4. VBA code to unhide X number of rows based on a number entered into a cell above
    By gazza365 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-09-2010, 08:48 PM
  5. formatting cell number based on previous cell number
    By Pasquini in forum Excel General
    Replies: 3
    Last Post: 06-20-2006, 01:40 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1