# Format Cells Based On Their Value

Jun 14, 2008

I was wondering if anyone knows how to create a formula that is dependent on the colors of a range of cells subject to conditional formatting. For example, I would like something that could answer =if(A1 is red,"Phillies",if(A1 is blue,"Mets","Marlins)). However, the text color will be generated from conditional formatting, so most of the VBA code I have found thus far isn't working properly. Does anyone know of a solution?

## Format Cells Based Upon Being Outside Scope Of Calculation Of 2 Cells

Feb 6, 2008

I am comparing a set of common variables across 2 sets of independent financial data. When comparing a variable across the 2 sets e.g. profit I want to colour a neighbouring cell based on the size of the difference. For example if the difference between the two values is within plus or minus 1 make it green, plus or minus 5 red etc.

## Format Cell Based On 2 Cells?

Nov 6, 2013

If F2 is blank and E2 date is older than or equal to today, bold and color E2 RED.

## Conditional Format Formula Based On Two Cells.

Apr 9, 2009

I want to create a conditional format formula which is based on values in 2 cells.

Example:

Cell B1 = 100
Cell C1 = 50

I want a formule for cell A1 which turns red for exmaple when B1 is higher then 85 and Cell C1 is lower then 85. Only in this case the conditional format should work.

## How To Conditional Format Based On Adjacent Cells

Oct 18, 2013

Picture1.jpg

How do I create a CF if a cell is blank (in my case represent no sales) i want to have it yellow (ex. C2)

But if it has two consecutive blank cell i want to CF with Red. (Ex. F3)

But i also need to exclude blank cells when we we have no previos sales of that item (Ex.B3).

## Format Based On Three Different Cells - IsError Check

Oct 30, 2013

I have a worksheet that I want to format based on three different cells. I had it set up with the following:

Code:
For i = 2 To LR

If Cells(i, 13).Value = "Price Mismatch" Then
Cells(i, 1).EntireRow.Interior.ColorIndex = 39

[Code] ........

Worked fine until one of the cells had an error in the result, I want to have this row colored also. I altered the first check to :

Code:

If Cells(i, 13).Value = "Price Mismatch" Or IsError(Cells(i, 13)) = "True" Then

I have tried multiple variations without success. I need to have the row colored if the value in the cell on the row in column 13 = Price Mismatch or is an error.

## Change Cells Format Based On Selection

Feb 15, 2010

I have created a named range that includes raw data layed out in 4 columns (Finish Name, Fill Color, Pattern, Font Color). On a separate sheet, when one of the finish names is selected in a particular cell, I want the cells fill, pattern, and font color to change according to the raw data. Below is the vba code I am trying to get to work. However, it is not working. It does not break, but does not achieve the desired result. It looks like the variables are getting set correctly, but still not changing the cell when they are referenced. I am only testing it on the first finish color, as seen in the code. All of the rest are static values for the cell, but I want the values to be dynamic.

Sub SetFinishSeparatorColor()
ActiveCell = frmFinishSeparator.cboFinish.Value
Set rngTarget = ActiveCell
With Sheets("Pick List Do Not Tamper").Range("Finish_Cell_Color")
lngFinishCellColor = . Find(What:=rngTarget, After:=.Cells(1, 1), _
LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False).Offset(0, 1)..............

## Format Cells Based On Conditional Count

Feb 15, 2010

I have a drawing register that contains drawing reference numbers in column D. When a new revision of a drawing is issued it is added to the bottom of the list. What I would like to do is any previous revisions to be greyed out and struck through.

The conditional formatting
= COUNTIF(\$D\$1:\$D\$100,D1)>1
works well but strike through all duplicates, I need the most up to date left without the format until it is superceeded

## Cell Number Format Based On Another Cells Value

Oct 21, 2007

If Cell A1 in my spreadsheet is 1, then cell A2 should appear formatted as a percentage. So if a user enters 9000 into cell A2, it should appear as 9000%. If Cell A1 in my spreadsheet is 2, then cell A2 should appear as a comma-formatted whole number. So if a user enters 9000 into cell A2, it should appear as 9,000. Conditional formatting doesn't appear to let me do this.

## Format Cells Color Based On 1 Cell

Nov 24, 2007

I want to format a group of cells color based on the value of one referance cell. Example would be: If a1 is adn "X" the the results in cells b1 thru b10 would be green else they would be blue. Is there a way to do this using Excel 97?

## Number Format Based On Corresponding Cells Text

May 15, 2008

Cell L90 to L120 are input cells where I type " Percentage" or "Dollar Amount". I need the five cells to the right of each input cell starting two cells over, to be formatted accordingly. I read a thread similar to what I'm asking for suggesting a worksheet change macro, but I can't quite figure it out for a range of cells. Also, in case I need to add a row to my sheet before all of these cells, how can I make sure that this will still work without having to go into the code. Is this an activecell thing?

## Format Color For Range Of Cells Based On Cell Value

Jul 1, 2008

I have been tasked with creating a Macro in order to help speed up a rather simple set of steps that are taken to format a spreadsheet each day. The last step, however, is not so simple. I would like to add a statement to the macro code that does that following:

Based on the value of a specific cell, color the cell and all corresponding cells within the same row (from colums A to AA) yellow. Essentially, cells in column D may have a the value "No Allocation", and if they do, I will need to format that cell yellow as well as all the cells within the same row for the colume range A to AA.

## Format Cells Based On Values In Pivot Table

Dec 23, 2009

I have a pivot table and next to it I added some calculations which are based on data from the table. In my "real" file, the cells next to the PT are formatted with conditional formatting based on other values in the sheet (see attached sample file). What I now need to do is add borders to the cells in columns “D:G” only if the cells in “B5” and downwards are not empty. I have tried doing it with conditional formatting but there are some other rules which contradict this setting.

The idea is to make the cells in columns “D:G” look like they are a natural extension on the PT. However, the table can grow or shrink (in length) and I want to see borders only around cells that are on the same rows as the data in column “B” (staring with B5). I think that whatever solution you can provide (if you can...) should be based a workbook_change event, because in my “real” file, the length of the table is changed whenever I select a different “page” of the PT.

## Format Cell Color Based On Others Cells Not Being Blank

Jan 9, 2008

I know that I need to use Conditional Formatting, but I can't get the formula code correct.

This is what I need it to do:

If cell A2 is populated (not blank) AND cell B2 is blank, then cell B2 to be highlighted in bright red fill.

If cell A2 is populated (not blank) and cell B2 is also populated (not blank), then leave formatting as per normal

If cell A2 is blank then leave formatting as per normal

Basically, as soon as someone types anything into cell A2, cell B2 to turn red. Then once they have input something into cell B2, the red highlight can disappear. The inputs will be text, not numbers, so I can't use </>

I have tried varying circumstances of IFs, ANDs, NOTs, ISBLANKs etc and I can't crack

## Conditional Format X Number Of Cells Based On A Single Cell?

May 4, 2014

I am looking for a method to conditionally format a variable number of cells below a single cell into which data is entered.

For example ABC = 6, DEF = 12. Therefore, if I enter ABC into D1 then D1:D6 should be conditionally formatted.

## Multiple Conditional Format Conditions Changed Based On Another Cells Value?

Jun 12, 2009

A1:A6 have numeric values 1 to 6.

I want the conditional format values to change Based on the value in Cell B2.

If the value in B2 is "old", then I want these conditional format conditions for A1:A6. Numbers between 1-2=green text, 3-4=orange text and 5-6=red text.

IF the value in B2 is "new" then I want the conditional format conditions in A1:A6 to change so 1=black text, 2-3=green text, 4-5=orange text and 6=red text.

I know how to do multiple conditional formats but i have no clue how to change multiple conditions based on another cells value.

## Auto Format Some Merged Cells Within A Sheet Based On The Information In Them

Feb 22, 2010

I am trying to auto format some merged cells within a sheet based on the information in them. how to reference the information within theses cells?

## Conditional Format Cells In Jan - Dec Columns Based On Next Column Data?

Jan 29, 2014

Wondering if it is possible to conditional format cells in "Jan"-"Dec" columns based on "Next" column data?

What I need is (lets say fill colour to differ) in one cell per row, based on latest input and "next" data.

Month Avg
Date
Jan
Feb
Mar
Apr
May
Jun
Jul

[code]......

So for example:

row2: May is latest input so need fill in cell +2("next" column data) from may. In this case July

row3: Feb is latest imput and "next" also 2. Result should be Apr

row8:May is latest input, "next" is 6. Res should be Nov.

Finally, only one cell per row to be highlighted so need to overwrite colour fill when new data input in a cell already colour filled.

## Automatically Format Range Based On Formula Result Of Cells

May 16, 2009

The following code works perfect but the "change" event is only triggered when working directly on intersect range. Tried using the "calculation" event but could not figure it out. This is what I want:

1) To replace the code provided below using the calculation event
2) To only trigger the event for the row(s) where the new value was generated, not for the whole "For Each" statement
3) To use one single code for all worksheets, instead of copying the code in every working worksheet on the workbook, if feasible
4) And I would like a "second alternative", where the user of the workbook can click on a button and trigger the event on every row on the workbook that has a non empty cell within the intersect range, assuming that the intersect range column is the same for all worksheets

Private Sub Worksheet_Change(ByVal Target As Range)
Dim c As Range, d As Range, fc As Long, bc As Long, bf As Boolean
Set d = Intersect(Range("I:I"), Target)
If d Is Nothing Then Exit Sub
For Each c In d
Select Case UCase(c)
Case "C"
fc = 1: fb = True: bc = 4
Case "O"
fc = 2: fb = True: bc = 3
Case "D"
fc = 2: fb = True: bc = 46
Case "G"
fc = 2: fb = True: bc = 5..................

## Conditional Format Color Of Cell Based On Values In Range Of Cells?

Oct 24, 2013

I would like to format the color of cell A1 on Sheet 1 based on true or false values from cell range A1:A10 on sheet 2. For instance:

1. If all cells on sheet 2 in range A1:A10 were false then cell A1 on sheet 1 would be red.

2. If some cells on sheet 2 in the range A1:A10 were false and some were true then cell A1 on sheet 1 would be yellow.

3. If all cells on sheet 2 in range A1:A10 were true then cell A1 on sheet 1 would be green.

## VBA Conditional Format Range Of Cells Based Upon Criteria In One Cell / Repeat For All Rows

Apr 3, 2014

Code is trying to

1. Where there is data in column B
2. Goto first row of data
2. If column J = "Closed"
3. then select Cells from column B to J in that row and colour these cells in red
4. If column J= "Open"
5. the select Celss from column B to J in that row and colour these cells in grey
4. Repeat for next row until you get to cell in column B where there is no data.

Recieve run time error 1004: Method 'RAnge of object_GLobal failed

===============================================================
Sub Colourclosed()
Sheets("Risks").Select
Dim LastRow As Long
Dim i As Long
LastRow = Range("B" & Rows.Count).End(xlUp).Row
For i = 8 To LastRow
If Range("J" & i).Value = "Closed" Then Range("B", "J" & i).Select
Selection.Interior.ColorIndex = 3

[code].....

Note: I've managed to do it for one cell ie for Column B by replacing "If Range("J" & i).Value = "Closed" Then Range("B", "J" & i).Select with "If Range("J" & i).Value = "Closed" Then Range("B" & i).Select" This works but only colours in cell in column B, how do i do this so it colours range of cells

## Change Cell Format Based On Existing Currency Format

Jun 12, 2008

I would like to have a single button that changes a range of cells from the USD to EURO to perhaps CAD symbol. Can this operation be performed, such that if I start in dollars, and I click the button once, it shifts by range to EURO (not formulas...just symbol)...and then if I click the same button again, it goes to CAD, and then back to USD with a third click?

## Convert Cells With Percentage Format To 'same' Decimal In A Column With Mixed Format

Jun 7, 2006

I have a column of cells with values - 0.2%, 0.32%, 0.22, 0.5 etc. The cells with % symbol are in ' Percentage, 2 decimal' format while the plain numbers are in 'General' format i.e. column contains cells in either of these formats. I need a macro where I can specify the column and it will select the cells with the % format, convert it to 'General' and multiply the result by 100 eg. 0.2% converted to 'General' becomes 0.002. When multiplied by 100, result is 0.2 i.e. is displayed without the % symbol.

## Time Format: Format Cells To Contain Minutes, Seconds And Hundredths

Oct 15, 2009

How can I format cells to contain Minutes, Seconds and Hundredths of seconds to be used in calculations eg 1.24.99 means 1 minute and 24.99 seconds. Example calculation is: 1.24.99 - 1.24.90 =0.0.09

## Format Cells To Change Name Format

Dec 6, 2013

Is it possible to change the contents of a cell (A1) displaying a name as:

John Smith

to Smith, John (in cell B1)

## Excel 2003 :: Conditional Format Top / Mid / Bottom 33% Of Cells But Ignoring Blank Cells

Mar 25, 2012

I am trying to conditionally format the top middle and bottom thirds of a range of data. Problem is, that the range needs to be flexible as sometimes there may be a maximum of 36 cells with data, but sometimes there may be less (so there are blank cells in the range that need not be counted). The methods I have tried always include the blank cells, and so it is not equally formatting the thirds (as it includes the blanks cells as part of the bottom data)....

Here are the 2 methods Ive tried so far using excel 2003)
Top 34%:
=IF(INT(COUNT(\$D\$3:\$D\$38)*34%)>0,LARGE(\$D\$3:\$D\$38,INT(COUNT(\$D\$3:\$D
\$38)*34%)),MAX( \$D\$3:\$D\$38))0,LARGE(\$D\$3:\$D\$38,INT(COUNT(\$D\$3:\$D
\$38)*67%)),MAX( \$D\$3:\$D\$38))0,LARGE(\$D\$3:\$D\$38,INT(COUNT(\$D\$3:\$D
\$38)*100%)),MAX( \$D\$3:\$D\$38))

## Conditional Format Cells Containing Numbers And Letters - Ignore Cells With Number Only

Jul 11, 2014

I have a column of numbers and want to make sure everything has been entered correctly from our scanning software. Basically, I want to automatically highlight any cell that has any letter in it (e.g. z12o2 instead of 21202 or R705 instead of 5705), ignoring any cells that contain only numbers. I haven't had any luck using conditions based on formulas like =ISTEXT.

## Format Setting Is The Same In All The Cells But Only Certain Rows/cells'

Jul 11, 2007

my excel setting... I'm not able to see some of the numbers (in currency/accounting) in excel file, it shows as many "#" sign, and it's not due to the column width. The same file can be seen in other computer.

The format setting is the same in all the cells but only certain rows/cells' numbers appear like "normal".

## Format Row Based On First Cell Value

Sep 21, 2012

Y3:Y500 contains a range of years, 2014/2015 through to 2018/2019, for a total of 5 different values (So conditional formatting is out the window). I'd like code which highlights the rest of the row, Z:FN, in a certain colour depending on the value in Y3:Y500.

Also, where there is data in the cells between Z:FN I'd like that to highlight in yet another contrasting colour.

## Conditional Format Based On Even / Odd?

Apr 23, 2007

I want to be able to change the font color of the numbers in a column based on even or odd. I selected the columns and formated them to all be blue... thats the color I want for even, but now I can't figure out how to set a condition that checks for odd numbers and changes them to red. I now have a count of even/odd for all records, and even/odd for the last 30, this provided some very interesting results.