+ Reply to Thread
Results 1 to 4 of 4

formula using text color

  1. #1
    Forum Contributor
    Join Date
    12-03-2008
    Location
    Key West, FL
    MS-Off Ver
    365 Apps for Enterprise
    Posts
    665

    formula using text color

    I've attached a spreadsheet to illustrate my question.

    I routinely copy/paste info to my worksheets. Sometimes the info is formatted so that negative numbers are expressed by using a red text color rather than a - sign or a ()

    Is there a way to create a new, custom formula I can add to my formula bar so that I can include text colors in functions?

    Obviously in this formula I'd use something like =if( A2 is red, A2*-1,A2)

    Any advice? I prefer not to have to write macros. I've never been able to figure out where to "keep them" for future use.

    Thanks!
    Attached Files Attached Files
    Last edited by jrtaylor; 07-13-2011 at 04:54 PM. Reason: solved

  2. #2
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: formula using text color

    Unfortunately, using VBA is your only option as Excel has no built-in worksheet functions that do anything with cell colors.
    However, creating a UDF is a piece of cake:

    Please Login or Register  to view this content.
    Put the preceding code in a standard module in your workbook to use it. Then just type GetCellValue() like you would any other worksheet function.
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  3. #3
    Valued Forum Contributor
    Join Date
    06-19-2010
    Location
    Holywell, N Wales, UK
    MS-Off Ver
    Excel 2013
    Posts
    470

    Re: formula using text color

    jr
    using conditional formatting may also be of interest
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    12-03-2008
    Location
    Key West, FL
    MS-Off Ver
    365 Apps for Enterprise
    Posts
    665

    Re: formula using text color

    Davegugg, thanks! I can save the "module" language in a .txt file for future use.

    I appreciate very much your help1

    (Barryleajo, thanks but conditional formatting doesn't work for this issue. We need to obtain a cell's text color and then write a formula depending on the color.)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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