+ Reply to Thread
Results 1 to 9 of 9

How to change or populate cell values based on cell colors

  1. #1
    Registered User
    Join Date
    05-01-2012
    Location
    SoCal, USA
    MS-Off Ver
    Excel 2010
    Posts
    7

    How to change or populate cell values based on cell colors

    Hello,

    I want to "Change a cell value based on cell color".

    And, if possible, "Change a range or group of cell values based on cell colors (that vary)"

    The only reason I am looking to do this is because I cannot find out how to "shuffle" this group of cells. Originally I wanted to assign these cells numbers and shuffle the whole box (range) randomly.

    So to get around that, I created a 10x10 table of cells with grouped fill colors, then assigned all cells random values with the =RAND() function, then sorted the box based on the random values, copy/pasted a transposed box, resorted, transposed, etc, until I had a completely random box of colors. Now I would like to assign each color it's own value, while keeping the colors exactly where they are. So for example, there are 4 green boxes in my diagram. I'd like to assign all 4 green boxes with a value of 20. There are 8 black boxes in my diagram. I'd like to assign each black box with a value of 10.

    See attached for my diagram. It should be noted that this is a miniature example version of my real project, which is many thousands of cells and would be virtually impossible to do manually.

    Also, I had posted this same question in this thread as a reply, but was told that is not allowed (my apologies for that). Here is the relevant thread for reference.

    http://www.excelforum.com/excel-gene...ell-color.html


    Thanks very much!
    Attached Files Attached Files
    Last edited by MrMacroMan; 05-01-2012 at 02:35 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    07-29-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    534

    Re: How to change or populate cell values based on cell colors

    See if the attachment does what you're looking for.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    05-01-2012
    Location
    SoCal, USA
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: How to change or populate cell values based on cell colors

    Quote Originally Posted by WHER View Post
    See if the attachment does what you're looking for.
    That looks brilliant! One question though. What do you mean by add an "associated value"? When I add in the values in column O and hit F9, nothing happens so I think I am missing something, especially since your next step is to change the values and hit F9 again. But if I can get that working, this solves my question perfectly.

  4. #4
    Forum Expert
    Join Date
    06-26-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2010
    Posts
    1,673

    Re: How to change or populate cell values based on cell colors

    Wow, all that work to shuffle...
    Here is a link to one of my posts which has a shuffle algorithm.
    http://www.excelforum.com/excel-gene...html?p=2729104

    Shouldn't be too hard to modify (I infer MrMacroMan knows macros).

    Pauley

  5. #5
    Valued Forum Contributor
    Join Date
    07-29-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    534

    Re: How to change or populate cell values based on cell colors

    By "adding an associated value" i mean the following: for example color some cells in the 10X10 table bright green(color as in N5), then add the number "30" to cell O5 (=associate "30" with bright green), then hit F9, the newly colored (green) cells should now display "30".
    This is how it works for me.

  6. #6
    Registered User
    Join Date
    05-01-2012
    Location
    SoCal, USA
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: How to change or populate cell values based on cell colors

    Quote Originally Posted by Pauleyb View Post
    Wow, all that work to shuffle...
    Here is a link to one of my posts which has a shuffle algorithm.
    http://www.excelforum.com/excel-gene...html?p=2729104

    Shouldn't be too hard to modify (I infer MrMacroMan knows macros).

    Pauley
    Hi Pauley,

    Thanks for that link. Either a shuffle or the color coded table like what WHER posted will work for me. I looked over your algorithm, and while I am definitely known as the macro guy by the folks around me, I think it's more realistic to say that I am just a big fish in a small pond there. I've built many macros that some would say are advanced, but I think mine are on a more intermediate level compared to some of you on here. So what I am really saying is that no I actually do not know how to modify that to fit my diagram. If you see a quick way to sort of "fill in the blanks" for my diagram, I think I could take that and apply it to my larger project.

    Whether you do or don't, thanks for answering

  7. #7
    Registered User
    Join Date
    05-01-2012
    Location
    SoCal, USA
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: How to change or populate cell values based on cell colors

    Quote Originally Posted by WHER View Post
    By "adding an associated value" i mean the following: for example color some cells in the 10X10 table bright green(color as in N5), then add the number "30" to cell O5 (=associate "30" with bright green), then hit F9, the newly colored (green) cells should now display "30".
    This is how it works for me.
    Hi WHER,

    Your sheet works perfectly for me as well. But I meant that it does not work when I recreate it in my own sheet. I've got all the same formulas in there, but for some reason, the table is not linking to the color index range. Specifically the "fmr". When I am in the formula (on yours) and hit F2, I can see that "fmr" is linking to the color index columns. In mine, it does not. Please see attached and let me know if you can spot where I am going wrong.

    Thanks!
    Attached Files Attached Files

  8. #8
    Valued Forum Contributor
    Join Date
    07-29-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    534

    Re: How to change or populate cell values based on cell colors

    Ok, i see. "frm" is a named formula that you have to define yourself under "Names".
    To see what i mean, open my attachment (post 2), select cell B2, then ctrl+F3 will open the "Name manager". Now you should see the
    named formula "frm". Look at the formula in the "refers to" box (with B2 still selected, important because parts of the formula are "relative") and take note of it.
    Now recreate the same named formula in your own workbook (also with B2 selected). The actual name (frm) is not important, it's just a random name.

  9. #9
    Registered User
    Join Date
    05-01-2012
    Location
    SoCal, USA
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: How to change or populate cell values based on cell colors

    Absolutely perfect. I did not realize that you had put a named formula in there.

    Anyway... I am now able to recreate this at whatever scale I need.

    Thanks so much WHER.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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

X vBulletin 4.1.8 Debug Information

  • Page Generation 0.07301 seconds
  • Memory Usage 9,064KB
  • Queries Executed 15 (?)
More Information
Template Usage (33):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (3)bbcode_quote
  • (1)footer
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (9)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (4)navbar_noticebit
  • (6)option
  • (3)postbit_attachment
  • (9)postbit_legacy
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (4)showthread_bookmarksite
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper
  • (1)vbseo_linkbackmenu_entry 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (39):
  • ./vbseo.php
  • ./env.php
  • ./vbseo/includes/functions_vbseo.php
  • ./vbseo/includes/functions_vbseo_pre.php
  • ./vbseo/includes/functions_vbseo_url.php
  • ./vbseo/includes/functions_vbseo_createurl.php
  • ./vbseo/includes/functions_vbseo_db.php
  • ./vbseo/includes/functions_vbseo_vb.php
  • ./vbseo/includes/functions_vbseo_seo.php
  • ./vbseo/includes/functions_vbseo_misc.php
  • ./vbseo/includes/functions_vbseo_crr.php
  • ./vbseo/includes/functions_vbseo_cache.php
  • ./vbseo/includes/functions_vbseo_hook.php
  • ./vbseo/includes/functions_vbseo_startup.php
  • ./includes/config.php
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/functions.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/functions_cforum.php
  • ./includes/functions_facebook.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php
  • ./includes/functions_notice.php 

Hooks Called (48):
  • init_startup
  • friendlyurl_resolve_class
  • database_pre_fetch_array
  • database_post_fetch_array
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • fetch_musername
  • cache_templates
  • template_register_var
  • parse_templates
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • reputation_image
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit
  • tag_fetchbit_complete
  • forumrules
  • showthread_bookmarkbit
  • navbits
  • navbits_complete
  • showthread_complete


Search Engine Friendly URLs by vBSEO 3.6.0 RC 1