+ Reply to Thread
Results 1 to 3 of 3

How to add value to cell based on background color

  1. #1
    Registered User
    Join Date
    04-15-2015
    Location
    Vietnam
    MS-Off Ver
    2013
    Posts
    3

    Question How to add value to cell based on background color

    Greetings,

    Is there any way to add value to a cell based on its background color?
    I'm current working on an excel file to assign working shift to the employees and calculate their total working hours per week.
    There are three shifts each day. I 'm using conditional formatting to change the cell color when the shift name is entered, Ex: type in Swing -> cell color will change to blue, Day->red and Night->orange. The Day and Night shift last for 8 hours and Swing shift lasts for 7 hours.

    Now I need to calculate the total working hours of the employees in a week. I'm trying to find a way to automatically assign the number of hours into the cell based on its color. I mean when the color of the cell is changed the number will automatically be assigned. Ex: Blue color is Swing shift so 7 hours will be assigned to the cell, red->Day->8 hrs, orange->Night->8hrs. Then I will use Sum function to sum all the values to calculate the total hours.Is there any formula or function to do so?

    Above is only what I think i should do, if there are any other viable ways to complete this requirement please share with me ?
    Sorry for the wall of text!

  2. #2
    Valued Forum Contributor
    Join Date
    04-12-2012
    Location
    India
    MS-Off Ver
    Excel 2007, 2010, 2013, 2016, 2019, Office 365, Google Spreadhsheet
    Posts
    640

    Re: How to add value to cell based on background color

    Check Below Post

    http://www.excelforum.com/excel-form...-by-color.html

    As mentioned in the above post, that you can not have formula based on Color in excel. A UDF is given in the above post may be it can work for you.

    Cheers!!!
    Anil
    Thanks,
    Anil Dhawan


    Click *Add Reputation to say "Thanks" and don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved) if you are satisfied.

    Don't stop when you are tired. STOP when you are done!

  3. #3
    Registered User
    Join Date
    04-15-2015
    Location
    Vietnam
    MS-Off Ver
    2013
    Posts
    3

    Re: How to add value to cell based on background color

    Thank you for the quick reply!

    The post shows the UDF to sum colored cells but I'm looking for a function to add a number value into the cell base on its color. A number value will be added or assign to the cell whenever the color is changed. Is there any UDF to do so? I'm looking everywhere in forum but still can't find one.
    Last edited by Anh Trinh; 04-15-2015 at 05:33 AM.

+ 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. Change cell background color based on another cells background color
    By Queo in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 4
    Last Post: 06-10-2014, 05:28 AM
  2. Replies: 4
    Last Post: 09-15-2012, 02:46 PM
  3. Macro Based on Cell Background Color
    By Kinchen in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-06-2011, 02:11 PM
  4. Set background color based on cell value
    By tgal in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 04-29-2011, 06:30 AM
  5. return a value based on cell background color
    By mccardled in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-18-2007, 03:55 AM

Tags for this Thread

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