Excel: Combining (Coercing) Different Data Value Types

Last reviewed: November 2, 1994
Article ID: Q63953

SUMMARY

When Microsoft Excel evaluates a formula and encounters different data types returned by expressions in the formula, it changes the data type returned by one expression to match the other, based on the operator between the two expressions.

Below are some simple worksheet examples of data type coercion among text, number, and logical value types in formulas. Assume cell A1 contains the number 10 and cell A2 contains the logical value TRUE.

   Formula                              Value Returned
   -------                              --------------

   ="Number in A1 is "&A1&"."           Number in A1 is 10.

   ="Logical value in A2 is "&A2&"."    Logical value in A2 is TRUE.

   ="5"+A1                              15

   =A1+A2                               11


KBCategory: kbother
KBSubcategory:

Additional reference words: noupd


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 2, 1994
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.