+ Reply to Thread
Results 1 to 9 of 9

How to change background color based on first row value?

  1. #1
    Forum Contributor
    Join Date
    03-04-2015
    Location
    Jakarta
    MS-Off Ver
    15
    Posts
    154

    Post How to change background color based on first row value?

    Plese, help me to change background of rows 2 to 10 based on first row value. I have columns A to J.
    If the value on the first row of certain column contains certain value so the cells of row 2 to 10 change to red. I hope there are some formulas to change it automatically from Conditional Formatting.

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: How to change background color based on first row value?

    Have a look at the conditional formatting formula in the attached.
    It will turn the relevant cells red if X is entered into row 1.
    You can obviously adapt the formula to reflect the value you need.

    BSB
    Attached Files Attached Files

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,695

    Re: How to change background color based on first row value?

    Select all the cells from A2 to J10, then click on Conditional Formatting | New Rule | Use a formula... , then put this formula in the dialogue box:

    =A$1=1

    You will need to change the 1 in red above to your "certain value". Click on the Format button | Fill tab and choose red then OK your way out.

    Hope this helps.

    Pete

  4. #4
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,911

    Re: How to change background color based on first row value?

    select A2:J10 and use below formula in conditional format

    A$1="YOUR VALUE" AND APPLY FORMAT
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  5. #5
    Forum Contributor
    Join Date
    03-04-2015
    Location
    Jakarta
    MS-Off Ver
    15
    Posts
    154

    Re: How to change background color based on first row value?

    I have multiple values, please help me to add the others on the formula

  6. #6
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: How to change background color based on first row value?

    If you have a small number of values you could use OR in the formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    If you have a larger number of values then put them in a range and use a COUNTIF formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    BSB

  7. #7
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: How to change background color based on first row value?

    Sheet1 in the attached demonstrates the OR method.
    Sheet2 demonstrates the COUNTIF method, where the range it compares with is the yellow cells.

    BSB
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    03-04-2015
    Location
    Jakarta
    MS-Off Ver
    15
    Posts
    154

    Re: How to change background color based on first row value?

    @Pete_UK & @nflsales thanks for the advice it works.

    @ BadlySpelledBuoy
    Thanks very much it works well for the multiple values.

  9. #9
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: How to change background color based on first row value?

    Happy to help. Thank for the rep point

    Don't forget to mark the thread as SOLVED if you're happy you have a working solution.

    BSB

+ 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] Change Background Color based on Value?
    By Jangorage in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-22-2014, 04:11 AM
  2. 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
  3. VBA code to change background color based on another fields value
    By SZIMM in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-18-2013, 01:57 PM
  4. Change Background Color Based On Cell
    By radicalrom in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-02-2013, 10:58 AM
  5. Change Background Color of Row Based on Cell Value
    By ashishashish8 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-21-2011, 02:51 PM
  6. Change cell background color based on data?
    By proepert in forum Excel General
    Replies: 2
    Last Post: 11-18-2009, 01:02 AM
  7. change text color based on background color
    By great.bean in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-05-2009, 07:07 PM

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