+ Reply to Thread
Results 1 to 11 of 11

Excel 2013 HELP! Macro that will return a value based off of Conditional Formatting Color

  1. #1
    Registered User
    Join Date
    01-11-2017
    Location
    GA
    MS-Off Ver
    MS 2013
    Posts
    9

    Lightbulb Excel 2013 HELP! Macro that will return a value based off of Conditional Formatting Color

    Good Day Everyone-

    I need help/assistance creating a VBA/Macro preferably a UDF that will look at a cell that contains conditional formatting and return a value in another cell. For example if cell "A1" is green based off of the conditional formatting criteria i set, I'd like cell "B1" to say "credit received", if cell "A1" is red I'd like cell "B1" to say "credit not received". Id like to use this for about 1000 rows of data in a specific column. I've attached an image and excel file of the final output i'm seeking in "column d". I've done a ton of searching online and have tested a few VBA's and none of them seems to be working for Excel 2013.

    CF Help.PNG

    Thank You all in advance!
    Attached Files Attached Files
    Last edited by rkmatthew; 01-12-2017 at 11:22 AM.

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Excel 2013 HELP! Macro that will return a value based off of Conditional Formatting Co

    I will offer the same advice I've seen whenever this question is asked: don't try to get the conditional formatting color. Use the criteria that sets the conditional formatting color to do whatever it is you want.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    01-11-2017
    Location
    GA
    MS-Off Ver
    MS 2013
    Posts
    9

    Re: Excel 2013 HELP! Macro that will return a value based off of Conditional Formatting Co

    Delete____
    Last edited by rkmatthew; 01-12-2017 at 01:20 PM.

  4. #4
    Registered User
    Join Date
    01-11-2017
    Location
    GA
    MS-Off Ver
    MS 2013
    Posts
    9

    Re: Excel 2013 HELP! Macro that will return a value based off of Conditional Formatting Co

    Quote Originally Posted by dflak View Post
    I will offer the same advice I've seen whenever this question is asked: don't try to get the conditional formatting color. Use the criteria that sets the conditional formatting color to do whatever it is you want.
    Hi, i've tried that but the formula doesn't seem to work. Below is the conditions i have set in the cells, any suggestions would be appreciated:

    Green: AND(J2<-5000,LEFT(I2,3)<>"541",LEFT(I2,3)<>"540")
    Red: AND(J2-L2=J2,J2>1000,LEFT(I2,3)<>"541",LEFT(I2,3)<>"540")
    Yellow: AND(J2/L2>120%,LEFT(I2,3)<>"541",LEFT(I2,3)<>"540")

  5. #5
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Excel 2013 HELP! Macro that will return a value based off of Conditional Formatting Co

    I don't see how your conditional formatting is working at all. Columns I, J and L are blank.

  6. #6
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Excel 2013 HELP! Macro that will return a value based off of Conditional Formatting Co

    I lifted the real conditions from the spreadsheet itself

    =AND(B2<-5000,LEFT(A2,3)<>"541",LEFT(A2,3)<>"540")
    =AND(B2-C2=B2,B2>1000,LEFT(A2,3)<>"541",LEFT(A2,3)<>"540")
    =AND(B2/C2>120%,LEFT(A2,3)<>"541",LEFT(A2,3)<>"540")

  7. #7
    Registered User
    Join Date
    01-11-2017
    Location
    GA
    MS-Off Ver
    MS 2013
    Posts
    9

    Re: Excel 2013 HELP! Macro that will return a value based off of Conditional Formatting Co

    Quote Originally Posted by dflak View Post
    I don't see how your conditional formatting is working at all. Columns I, J and L are blank.
    Sorry i modified worksheet before uploading, in the uploaded sheet column J = Column B, Column I = Column A, Column L = Column C. The attached worksheet reflects these changes. Thanks

  8. #8
    Registered User
    Join Date
    01-11-2017
    Location
    GA
    MS-Off Ver
    MS 2013
    Posts
    9

    Re: Excel 2013 HELP! Macro that will return a value based off of Conditional Formatting Co

    Delete____

  9. #9
    Registered User
    Join Date
    01-11-2017
    Location
    GA
    MS-Off Ver
    MS 2013
    Posts
    9

    Re: Excel 2013 HELP! Macro that will return a value based off of Conditional Formatting Co

    Quote Originally Posted by dflak View Post
    I lifted the real conditions from the spreadsheet itself

    =AND(B2<-5000,LEFT(A2,3)<>"541",LEFT(A2,3)<>"540")
    =AND(B2-C2=B2,B2>1000,LEFT(A2,3)<>"541",LEFT(A2,3)<>"540")
    =AND(B2/C2>120%,LEFT(A2,3)<>"541",LEFT(A2,3)<>"540")
    That would be correct.

  10. #10
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Excel 2013 HELP! Macro that will return a value based off of Conditional Formatting Co

    In the attached, I have some helper columns that can be deleted. I left them there because they show the intermediate steps to developing the ultimate formula.

    These three columns are the criteria for the conditional formats. Note that Yellow has a couple #DIV/0! errors. Column H has the first step of the formula which is basically =IF (Green, "Credit Received", IF (Red, "Credit Not Received", "Something Else")) - you didn't say what to do about not green and not red.

    Column I is the same formula except I substituted the actual formulas for the intermediate cells).
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    01-11-2017
    Location
    GA
    MS-Off Ver
    MS 2013
    Posts
    9

    Re: Excel 2013 HELP! Macro that will return a value based off of Conditional Formatting Co

    Quote Originally Posted by dflak View Post
    In the attached, I have some helper columns that can be deleted. I left them there because they show the intermediate steps to developing the ultimate formula.

    These three columns are the criteria for the conditional formats. Note that Yellow has a couple #DIV/0! errors. Column H has the first step of the formula which is basically =IF (Green, "Credit Received", IF (Red, "Credit Not Received", "Something Else")) - you didn't say what to do about not green and not red.

    Column I is the same formula except I substituted the actual formulas for the intermediate cells).
    This is AWESOME. Thank You So Much.

+ 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. [SOLVED] Color scale conditional formatting based on another cell's value
    By johnharrison in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-18-2016, 01:42 PM
  2. [SOLVED] fill color row based on conditional formatting
    By k1dr0ck in forum Excel General
    Replies: 3
    Last Post: 09-02-2016, 02:56 AM
  3. Conditional formatting based on text color
    By iloveexcelsomuch in forum Excel General
    Replies: 8
    Last Post: 09-16-2015, 09:01 AM
  4. Add conditional formatting based on color of a cell
    By dreddster in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-12-2015, 04:54 AM
  5. [SOLVED] Conditional Formatting based on Text Color
    By JBailey-LMC in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-25-2013, 03:22 PM
  6. To clear content if conditional formatting cell return gray color
    By W.Patrick in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-18-2013, 01:00 PM
  7. Conditional Formatting Based on Cell Color Help
    By gvsu141 in forum Excel General
    Replies: 1
    Last Post: 04-15-2011, 07:44 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