0

In Excel 2010, I want cell A1 to have the same value as cell A2. So I set a formula in A1:

=B1

that works fine if B1 has a value. But, if B1 is empty, then A1 shows "0". I want A1 to be empty if B1 is empty.

As a workaround, I'm using the following formula in A1:

=IF(B1="", "", B1)

Is there an easier and more elegant way to set a cell to the same value as other cell? (without VBA)

freesoft
  • 1,114
  • 3
  • 17
  • 26

3 Answers3

3

That's the way Excel works I'm afraid. =B1 will display a zero if B1 is empty. Futhermore ISNNUMBER(B1) will return True. So it is a genuine zero, not something formatted as a zero.

A common workaround is to use something like:

=IF(ISBLANK(B1), "", B1)

which, I think, is more elegant than an empty string comparison.

Bathsheba
  • 231,907
  • 34
  • 361
  • 483
  • Well it is very similar to me. I was thinking in something simpler, such as "=COPY(B1)", or even "==B1". – freesoft Apr 08 '14 at 09:20
0

Google spreadsheet works exactly as you need. Using

=A1

in B1, you get the desired empty B1 when A1 is empty.

Alexander Vogt
  • 17,879
  • 13
  • 52
  • 68
J.Ty.
  • 16
  • 1
0

Under Excel Options > Advanced > Display options for this worksheet, is a tick box called 'Show a Zero in Cells that have zero value'. If you un-tick it then your formula will display blank if they result in zero. Only downside is that all cells that have a zero value (not from a formula) will also display blank.

Dave Sexton
  • 10,768
  • 3
  • 42
  • 56