0
votes

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?

2
Congratulations! You have reached the limits of Excel. In order to expand these limits, you need VBA. google.com/search?q=what+is+vba+in+excel - Vityata
An Excel formula can only change the value of the cell it resides in, so the formulas would have to be present in those cells. Why does it matter if the cells have formulas (that you can't see)? - ashleedawg
...but I think the formula you had intended was: (in Cell A1: =IF(B1="end","100%","") ...and then copy and paste to other cells in column A and the formula will automatically adjust to be looking at the cell in column B that's next to it. Conditional Formatting on the other hand can affect any cells you want, but it's formatting only. So you could make the cell Green with nothing in it, but you can't make it say "100%" without having "something" in the cell all the time. - ashleedawg

2 Answers

1
votes

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.

0
votes

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

example3

Using cells I2:J9 as an example, the steps are:

  1. Click I2, then Ctrl+1 to open the Format Cells dialog.

  2. On the Number tab, click Custom, then in the Type box enter: ;;; and click OK.

  3. Hit Alt+O+D+N to add new Conditional Format and choose Use a formula to determine which cells to format.

  4. In the Format values where... box, enter: =J2="end" (If Excel adds $'s, remove them), then click Format...

  5. 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.

  6. Click I2, hit your SPACEBAR once and then hit ENTER. (* Fine, I confess: the cell isn't totally empty.)

  7. Click I2 and hit Ctrl+C to Copy.

  8. 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:

screenshot example

These cells do appear empty, unless you to click on the cell and then look at the formula bar:

ex1 ex2

...but the formula bar can be hidden too:

hide formula bar