+ Reply to Thread
Results 1 to 8 of 8

Returning number as text in IF formula

  1. #1
    Registered User
    Join Date
    10-06-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    7

    Returning number as text in IF formula

    Hello,

    This is probably a pretty basic question, but I can't find an answer in Excel help or on the interwebs. I have an IF formula and I'd like 0 returned if the statement is false (e.g. =IF(A1<>0, A1, 0)); however, I would like the 0 returned as text. I've tried the TEXT function and using ` in different places, but all to no avail. Any suggestions would be appreciated.

    Thanks!
    Last edited by Canucklehead; 10-06-2009 at 11:22 AM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Returning number as text in IF formula

    You mean?

    =IF(A1<>0, A1, "0")
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    10-06-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Returning number as text in IF formula

    I've tried that, but I can still manipulate the resulting output (e.g. I tried it using "5" and the 5 would still be counted for =AVERAGE purposes).

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Returning number as text in IF formula

    Perhaps you can attach a small spreadsheet showing exactly what your ultimate goal is? This may help speed things up.. and limit guessing.

  5. #5
    Registered User
    Join Date
    10-06-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Returning number as text in IF formula

    Okay, here it is. I note now that using a function (e.g. =AVERAGE) ignores the text-number (in this case I used 5 as a sample); however, a straight-up addition includes the 5, even though it is stored as text. I suppose I can avoid the issue altogether if I just use =SUM.
    Attached Files Attached Files

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Returning number as text in IF formula

    Well, I guess then you solved it... use SUM() and AVERAGE() ignores text...

    use +,*,-,/ does not ignore text.. they convert to numbers...

  7. #7
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Returning number as text in IF formula

    I suppose I can avoid the issue altogether if I just use =SUM.
    Echoing NBVC the use of mathematical operators will automatically attempt to coerce values to numerics - returning #VALUE! when the coercion is not valid, eg

    =0+"4" -> 4
    =0+"apple" -> #VALUE! as "apple" can not be coerced to number

    As already outlined the likes of SUM & AVERAGE will not explicitly coerce and will only look to numeric values.

    =SUM(0,"4") -> 0
    Last edited by NBVC; 10-06-2009 at 11:22 AM. Reason: corrected spelling of my name

  8. #8
    Registered User
    Join Date
    10-06-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Returning number as text in IF formula

    Thanks for the info and explanations, knowing Excel's coercive ways will come in handy in the future.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1