Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

In EXCEL, how can I use the "=" command, to ALSO bring in the format code used for a cell?

in other words...

Using format codes for the cell...

A1=05

A2=0005

B1=4

B2=if(b1=4;A2;A1)

both results make B2=5

I need it to also return the correct number of characters by replicated the original cell exactly.

2 Answers

Relevance
  • Nahum
    Lv 7
    5 years ago
    Favorite Answer

    Not possible with formulas alone, supposing your values are numeric. Formats are independent, unless you use Conditional Formatting.

    If the values are text, set B2 to Text format as well. The exact characters will be copied as they are.

  • 5 years ago

    IF(B1=5;TEXT(A1;"00000");IF(B1=4;TEXT(A1;"0000");TEXT(A1;"000")))

    THIS WORKED!!! (and I don't even need cell A2!)

Still have questions? Get your answers by asking now.