Edit in response to the question's clarification:
In your Google Spreadsheet window, there is a menu Format with the option "Change color with rules". This is as technical as Google Spreadsheet's conditional formatting is. As far as I can tell, there is no way to color one cell based on another's value - Google doesn't let you enter formulas for other cells.
Unless you're putting other data into column B, you could always make all of column B equal column A, and then use the "Change color with rules" option to color all the cells with the value of 1 with like colors - ie, red background and red text when the value is 1, white background and white text when it is not, effectively hiding the value in column B. That will give you the look you want.
In Excel, you can do what you want. Using your data as an example, I conditionally formatted B1 when this formula is true:
and then dragged the formatting down, which highlighted only the cells in B where it's a neighbour in column A equalled 1.
I'm not sure if you can do this in 2 columns, but I know you can do it in 3:
A | B | C
1 | f | x
In the B column, you can use the
IF formula to see whether an x has been placed in the appropriate C column:
IF formula has 3 parts - the test, the then value, and the else value. In the above example, the formula checks to see if there is an
x in the C column. If there is, it enters the value from A1, otherwise, it enters a blank. It doesn't matter if the
x is upper- or lower-case.
Once you enter this formula at the top of your list, you can use the drag feature to drag the formula down for the rest of your list. With the cell highlighted in blue, move your mouse over the square in the lower right corner until the cursor becomes a crosshair. Then just click and hold while dragging down to copy the formula to the cells below.