Conditional formatting depending on data from a column - excel

I'd like to create a rule that writes "100%" in column A whenever I write "end" in column B.
So it would be something like this:
[] X
100% end
[] Y
The brackets represent an empty cell.
I've tried:
IF(B1:B3="end",100%,"")
but I would like to leave the cells on column A empty, with no data or formulas, if the respective cell in column B doesn't contain "end".
So I've thought about adding a new rule with conditional formatting but it's not working. Any solutions?

Can be achieved with CF but rather nastily. You would need to fill ColumnA first, say with 1s - but can be hidden by (standard) formatting the text to match the background colour (ie usually white).
Then clear any CF from and select ColumnA, HOME > Styles - Conditional Formatting, New Rule..., Use a formula to determine which cells to format and Format values where this formula is true::
=B1="end"
Format..., select Black (probably) font and Custom Number format of:
00%
OK, OK.
If your blank cells must remain blank in reality rather than appearance then CF alone is not a solution for you.

Edit:
You can get a value to show in a cell based on the value of another cell, without having anything* in the cell, and without VBA:
                                                         *kinda
Using cells I2:J9 as an example, the steps are:
Click I2, then Ctrl+1 to open the Format Cells dialog.
On the Number tab, click Custom, then in the Type box enter: ;;; and click OK.
Hit Alt+O+D+N to add new Conditional Format and choose Use a formula to determine which
cells to format.
In the Format values where... box, enter: =J2="end" (If Excel adds $'s, remove them), then click Format...
On the Number tab, click Custom, then in the Type box enter: ;;;"100%" . (Optionally set a color, font, etc.) then hit ENTER 3 times to return to the
worksheet.
Click I2, hit your SPACEBAR once and then hit ENTER. (* Fine, I
confess: the cell isn't totally empty.)
Click I2 and hit Ctrl+C to Copy.
Select I2:J9 and press Alt+E+S+T then hit
ENTER to Paste Formats.
Now when you type end into any of J2:J9, the corresponding cell in column I will display 100%.
You can also repeat this process to add additional conditions to the same cells if needed.
Original Answer: (Alternative Solutions)
Sometimes I get stuck spending too much time on a question about a very minor issue. This is one of those times. :)
Thinking further about your question, I suspect you might not have meant you need the "cells on column A empty, with no data or formulas", but perhaps you mean you want the cells to "appear empty".
Example:
These cells do appear empty, unless you to click on the cell and then look at the formula bar:
...but the formula bar can be hidden too:

Related

Find the satisfied cell in a area then highlight the row the cell lying

I want to find all the cells > 100 in the area 'A1:E13', then highlight the row the cell lying. I used the new rule of Conditional formatting with formula '=$A1:$E13>100'. It seems work for a single column, but not work for an area.
Clear any existing formatting from A1:E13 select that range and HOME > Styles - Conditional Formatting, New Rule..., Use a formula to determine which cells to format and Format values where this formula is true::
=OR($A1>100,$B1>100,$C1>100,$D1>100,$E1>100)
Format..., select formatting, OK, OK.
(Will also highlight any rows containing Text. "Row" here is five columns wide.)
Without using any addtional column, you have to use this formula for the conditional formatting :
=(MAX($A1:$E1)>100)
Please be careful with the absolute (with $) and relative references, and do not forget the () around the formula.
Please also note that you have to select your area from top to bottom, i.e. you click into A1, hold mouse button and move down and right with the mouse, and release mouse button over E13 (which is probably the natural way of doing it!); if you start from the bottom (e.g. click in cell E13 and release over A1), then you have to test in the Conditional formatting =(MAX($A13:$E13)>100). This is because the conditional formatting takes the cell which is highlighted within the selected area as starting point for relative references to evaluate the formula.
If you want to use an additional column (e.g. F) in your worksheet (which you can hide later of course), it is even easier:
- In cell F1 you put MAX(A1:E1)
- With conditional formatting ("Use a formula to determine which cells to format"), you test whether $F1>100 for your entire range.

Automatically apply fill colour conditional upon row by row comparison of two columns

I have two Excel columns of numerical natural values and of the same length.
For each row I would like to fill the cells with red if the values are different, with green if they are equal.
I thought I could do this using Conditional Formatting but it seems it is not fit to compare two columns.
Am I wrong? How can I do that? How to use an IF statement for this?
Assuming the values are in column A and B
To create the first rule:
Select columns A an B. Do this by dragging from column header A to
B.
Then, click Home > Conditional Formatting > New Rule.
In the New Formatting Rule dialog box, click Use a formula to
determine which cells to format.
Under Format values where this formula is true, type the formula:
=$A1=$B1
Click Format.
Select a green fill color.
Click OK until the dialog boxes are closed.
The formatting is applied to column A and B.
Now you can create a second rule for =$A1<>$B1 with red fill color.
A "cheat" (if your columns are not too long) is to transpose your two columns, then use CF's Highlight Cells Duplicate Values rule (but change the default colours to suit) and transpose back again. It may be a slight advantage of this transposition that formatting will not be applied to cells in the same row that are both blank (though easy enough to arrange for this with a formula rule).
The point of my answering however is really to say that you only need one rule. Since every cell is going to be either red or green using standard formatting for one format is sufficient. For example, fill your entire data set with 'standard' green fill and then apply a formula rule for red. This will happily override the 'standard' green fill where appropriate.
If applied to Range $A:$B (such as by first selecting ColumnsA:B) I suggest a formula rule of:
=AND(A1<>"",$A1=$B1)
You do not need an IF statement because the formatting is conditional (the IF is implicit).
Assuming your data is in columns A and B, first select the column you want to colorize.
Then for the green :
Conditionnal Formatting > New Rule > Use Formula to determine... > type formula : =(A1=B2)
Then Click the Format... button and choose Green color
And for the red :
Conditionnal Formatting > New Rule > Use Formula to determine... > type formula : =(A1<>B2)
Then Click the Format... button and choose Red color

Excel conditional formatting using generic formula

I want to conditionally format cells in Excel. Is it possible to create a generic formula that does the following:
IF the value in column A of the given row = "A"
AND the value in the given cell is greater than .1
AND the value in the given cell is less than 1
THEN format the cell with a light grey background color
In the example below, I want the formula to apply to cells B1:K2, but I only want cells E1, I1 and K1 to be highlighted in grey.
Select B1:K[n]. B1 is the active cell.
Then, click Home > Conditional Formatting > New Rule.
In the New Formatting Rule dialog box, click Use a formula to
determine which cells to format.
Under Format values where this formula is true, type the formula:
=AND($A1="A",B1>0.1,B1<1)
Click Format.
In the Fill box, select your light gray color.
Click OK until the dialog boxes are closed.
Greetings
Axel
Tap F5 and when the GoTo dialog opens, type A:K (◄ just like that) into the Reference: box and click OK. You should have columns A through K selected with A1 as the Active Cell.
Create a new Conditional Formatting Rule using the Use a formula to determine which cells to format option and supply the following for Format values where this formula is true:
=AND($A1="A", A1>0.1, A1<1, ISODD(COLUMN(A:A)))
Click Format and select a light=grey Fill then click OK to accept the format and then OK again to create the new CF rule. Your results should resemble the following.
    
Edit: Revised from literal interpretation to subjective interpretation
Select cells E1:F2,I1:I2,K1:K2 (hold down Ctrl while selecting discontinuous range) so the conditional formatting will apply to them.
The cell K1 should have the focus, i.e. be highlighted with white background, while other selected cells are highlighted with dark background. Insert conditional formatting with following formula:
=($A1="A")*(K1>0.1)*(K1<1)

Conditional data entry on certain text in excel

I'm after some pointers.
I want to input text into some cells based on the contents of others.
Current formula that I'm using in cell B1 is
=IF(ISERROR(FIND("example",A1)),"no","yes")
So far, so simple. This works. Inputs 'yes' in B1 if 'example' is located in the cell A1, copy down.
However, there are some cells in the B column which have already been formatted with other text in, and I want to apply this formula on the entire spreadsheet without removing the existing text in column B. So far, the only thing I can think of is by putting this formula in the C column, copying down then moving the text from the C column to the B column - but this requires laborious copy and pasting that kind of negates the time saving provided by the formula.
What is the best way to achieve this? Do I need to resort to VB to scan the entire sheet, iterating through A1-A30000 and inserting the requisite text in B column?
Cheers.
Edit:
So, this has been pretty much sorted, with a variety of suggestions.
However, the actual formula I'm using is:
=IF(ISERROR(FIND("example",A1)),"","yes")
as I only want text to be put in columnB if the pattern is found. This has presented another problem! The double quotes signifying no replacement if the pattern ISN'T found actually inserts a 'NULL' character in there; when you try and select the blank cells on the next iteration of the operation, no cells are selected, as even though there is no visible character, Excel thinks there is. xD
This is solved by writing a macro function to remove Null characters.
Excel is infuriating sometimes. :P
All of the information and advice already given is definitely correct and gets the job done,
byt thought I'd add one that does not require ANY changes to the existing data (eg sorting or filtering):
Put your formula as you described is cell B1. Apply any conditional formatting to that cell, as required.
Now select and copy (ctrl+C) cell B1. Select column B (click on column heading).
Then Click find and Select (binoculars icon) - on Home ribbon tab. Choose go to Special.
In the popup choose Blanks and click ok. You will note all blank cells in colum B are selected. Don’t click anything, press Crtl-V.
Voilà, your formula and conditional formatting is pasted into all blank cells, leaving the rest alone.
Quick keyboard sequence:
select B1
Press ‘Ctrl + C’
Ctrl + ‘Space Bar’
Press ‘Ctrl + G’
Press Tab twice to go to ‘Special…’ button, press Enter
Press ‘K’ for blanks, Press Enter
Press ‘Ctrl + V’
(optional) press escape to remove selection from B1
There are a few ways to deal with this. I'll explain 2 of them :
If sorting is an option, sort your table by column B (ascending / A-Z) to get all the empty values at the top. Write your formula in the first blank cell and extend it by double-clicking the bottom-right corner of that cell.
If you cannot sort, apply filters to the table and select only the blank cells in column B. Then write the formula in the first blank cell and extend it by dragging it down to the last cell.
You might combine your existing B column values with those to be added conditionally in a single formula, say in ColumnC, such as:
=IF(ISBLANK(B1),IF(ISERROR(FIND("example",A1)),"no","yes"),B1)
copied down to suit. Then if ColumnB has become redundant, copy ColumnC, Paste Special, Values over the top and delete ColumnB. The result is to convert the formulae to the results thereof, that may increase processing speed but reduce the ease of handling additional rows (if any) subject to the same requirements.

Conditionally formatting if multiple cells are blank (no numerics throughout spreadsheet )

I have created a spreadsheet in Excel and am attempting to use Conditional Formatting to highlight a cell or row if any or all of the cells in the last four columns are blank. My columns consist of name of account, store manager, city, state, visit 1, visit 2, visit 3 and visit 4.
When an account is visited notes are written in the "Visit" cell and if an account does not need a visit an X is put in each "Visit" column that is not needed (some accounts need one visit, some two, some all four).
Is it possible to have the Account Name and/or Manager Name highlighted when any visits are left blank, indicating they need to set up a visit that is necessary?
I have tried the instructions below but it didn't seem to work for the range of information I was looking for.
Open the 'Conditional Formatting Rules Manager' (Conditional
Formatting->Manage Rules).
Click 'New Rule' and choose "Use a formula to determine which cells
to format".
In the "Format values where this formula is true:" box, enter the
cell which you want to check if blank.
Place a dollar sign in front of the letter of the cell reference to
make it affect only that row, not the whole table or just the cell.
Type ="" at the end of the box to check for if the cell is blank.
Click "Format..." and go to the "Fill" tab to choose a colour to
fill the row if true and click "OK".
Click "Okay" to close the 'New Rule' dialog.
Change the "Applies to" value of the rule you just created to the
scope of the entire table to make the rule apply to it. (If your
table has a reference name, you can enter it here)
Click "Okay to close the 'Conditional Formatting Rules Manager'.
How about just > Format only cells that contain - in the drop down box select Blanks
Select columns A:H with A1 as the active cell.
Open Home ► Styles ► Conditional Formatting ► New Rule.
Choose Use a formula to determine which cells to format and supply one of the following formulas¹ in the Format values where this formula is true: text box.
To highlight the Account and Store Manager columns when one of the four dates is blank:        =AND(LEN($A1), COLUMN()<3, COUNTBLANK($E1:$H1))
To highlight the Account, Store Manager and blank date columns when one of the four dates is blank:        =AND(LEN($A1), OR(COLUMN()<3, AND(COLUMN()>4, COUNTBLANK(A1))), COUNTBLANK($E1:$H1))
Click [Format] and select a cell Fill.
Click [OK] to accept the formatting and then [OK] again to create the new rule. In both cases, the Applies to: will refer to =$A:$H.
Results should be similar to the following.
  
¹ The COUNTBLANK function was introduced with Excel 2007. It will count both true blanks and zero-length strings left by formulas (e.g. "").
The steps you took are not appropriate because the cell you want formatted is not the trigger cell (presumably won't normally be blank). In your case you want formatting to apply to one set of cells according to the status of various other cells. I suggest with data layout as shown in the image (and with thanks to #xQbert for a start on a suitable formula) you select ColumnA and:
HOME > Styles - Conditional Formatting, New Rule..., Use a formula to determine which cells to format and Format values where this formula is true::
=AND(LEN(E1)*LEN(F1)*LEN(G1)*LEN(H1)=0,NOT(ISBLANK(A1)))
Format..., select formatting, OK, OK.
where I have filled yellow the cells that are triggering the red fill result.
If you place the dollar sign before the letter, you will affect only the column, not the row.
If you want to have it affect only a row, place the dollar before the number.
You may want to use =isblank() rather than =""
I'm also confused by your comment "no values throughout spreadsheet - just text" - text is a value.
One more hint - excel has a habit of rewriting rules - I don't know how many rules I've written only to discover that excel has changed the values in the "apply to" or formula entry fields.
If you could post an example, I'll revise the answer. Conditional formatting is very finicky.

Resources