+ Reply to Thread
Results 1 to 12 of 12

Formula to add a value to a cell, based on cell to the left's color

  1. #1
    Registered User
    Join Date
    12-10-2013
    Location
    New York ny
    MS-Off Ver
    Excel 2011
    Posts
    6

    Formula to add a value to a cell, based on cell to the left's color

    I would like to add a value to a cell. The value in this cell will either be 1, 2, 3 or 4.
    The value of this cell needs to be "1", if the cell to its left is "Red".
    The value of this cell needs to be "2", if the cell to its left is "Purple".
    The value of this cell needs to be "3", if the cell to its left is "Green".
    The value of this cell needs to be "4", if the cell to its left is "Blue".

    Thank you so much for your help with this, I really appreciate whatever you can share. I believe I need to find the HEX values for the colors, but that is no problem, I just need the formula of the function if you know it. Thanks again.

  2. #2
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: Formula to add a value to a cell, based on cell to the left's color

    How did you arrive in those colors any explanations? did you used conditional formatting?

    if you just colored them, you cannot use formula as you are requesting. Though vba could do it. PM me and i will move your thread to vba/programming subforum.

    Regards,
    Vladimir
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

  3. #3
    Registered User
    Join Date
    12-10-2013
    Location
    New York ny
    MS-Off Ver
    Excel 2011
    Posts
    6

    Re: Formula to add a value to a cell, based on cell to the left's color

    Yes, I used conditional formatting. In column R, there is a pull-down list menu with 4 choices. If choice one is selected, then the cell turns red.
    I would like the cell next to it to have a number "1" in it, if the cell to its left is red.

  4. #4
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: Formula to add a value to a cell, based on cell to the left's color

    You can then base the formula in that conditional formatting rule.

    something like this maybe

    =if(R1=choice1,1,if(R1=choice2,2,if(r1=choice3,3,4)))

    so you will not be "referring" to the cell with the colors instead in column R choices.

  5. #5
    Registered User
    Join Date
    12-10-2013
    Location
    New York ny
    MS-Off Ver
    Excel 2011
    Posts
    6

    Re: Formula to add a value to a cell, based on cell to the left's color

    thx, I am almost there but I keep getting #NAME error.
    ug I thank you for your patience, If you have a suggestion, I will try

  6. #6
    Registered User
    Join Date
    12-10-2013
    Location
    New York ny
    MS-Off Ver
    Excel 2011
    Posts
    6

    Re: Formula to add a value to a cell, based on cell to the left's color

    I then tried to add that formula to a new conditional format, but its not working yet

  7. #7
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: Formula to add a value to a cell, based on cell to the left's color

    my mistake

    =if(R1=choice1,1,if(R1=choice2,2,if(r1=choice3,3,4)))

    you have to put the real choices on those pull down list and if they are text be sure to enclose then to quotation marks
    say your drop down list is A,B,C,D located in R1

    =if(R1="A",1,if(R1="B",2,if(R1="C",3,4)))

  8. #8
    Registered User
    Join Date
    12-10-2013
    Location
    New York ny
    MS-Off Ver
    Excel 2011
    Posts
    6

    Re: Formula to add a value to a cell, based on cell to the left's color

    My actual cell is F3 so this is what I wrote based on your suggestion above

    =if(F3=H23,1,if(F3=H24,2,if(F3=H25,3,if(F3=H26,4)))

    oh my goodness, it worked. If it you have time, can we add color to this new cell also? such as

    =if(F3=H23,1 "color =red", etc..?

  9. #9
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: Formula to add a value to a cell, based on cell to the left's color

    thats conditional formatting
    in the above post
    can we add color to this new cell also
    in CF use formula.
    =new cell=1 -->select color
    then create another cf for
    =new cell=2
    ...
    say the new cell is D1
    so in cf
    =d1=1 -> select color
    =d1=2 -> select color
    =d1=3 -> select color
    =d1=4 -> select color

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Formula to add a value to a cell, based on cell to the left's color

    Quote Originally Posted by hellinabucket View Post

    =if(F3=H23,1,if(F3=H24,2,if(F3=H25,3,if(F3=H26,4)))
    This may work and is a few keystrokes shorter.

    =MATCH(F3,H23:H26,0)
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  11. #11
    Registered User
    Join Date
    12-10-2013
    Location
    New York ny
    MS-Off Ver
    Excel 2011
    Posts
    6

    Re: Formula to add a value to a cell, based on cell to the left's color

    wow
    this was my first time on this forum
    I really appreciate your help. cheers to you

  12. #12
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Formula to add a value to a cell, based on cell to the left's color

    Based on your last post in this thread, its apparent that you are satisfied with the solution(s) you've received and have solved your question, but you haven't marked your thread as "SOLVED". I will do it for you this time.

    In future, to mark your thread as Solved, you can do the following -
    Select Thread Tools-> Mark thread as Solved.

    Incase your issue is not solved, you can undo it as follows -
    Select Thread Tools-> Mark thread as Unsolved.

    Also, since you are relatively new to the forum, i would like to inform you that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post which helped you. This adds to the reputation of the person who has taken the time to help you.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ 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. Color tab based on cell value but ignore formula
    By freeon in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-12-2013, 03:41 PM
  2. [SOLVED] Color-format a cell which contains data in a column based on the color of another cell
    By Nit3hawK in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-27-2013, 05:25 PM
  3. Replies: 5
    Last Post: 05-10-2012, 10:49 PM
  4. Color code cell with case statement and datestamp cell(s) to the left
    By garricko in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-26-2010, 08:37 PM
  5. formula based on cell background color
    By seyah in forum Excel General
    Replies: 2
    Last Post: 05-11-2007, 05:20 PM

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