+ Reply to Thread
Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    06-28-2007
    Posts
    31

    Text and numbers

    Hi all,

    i wish to add the sum of 2 coulmns, however on some occasions some cells may contain text, in some instances both cells may contain text, is there a formula to get around this problem.


    thanks
    steviegee

  2. #2
    Forum Guru martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    10,477

    Re: Text and numbers

    Try
    =if(and(istext(a1),istext(b1)),0,if(istext(a1),b1,if(istext(b1),a1,a1+b1)))
    Mojito connoisseur and a dabbler in Cisco
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    06-28-2007
    Posts
    31

    Re: Text and numbers

    Genius,


    Many thanks,
    thats solved the situation nicely.


    Thanks for the tips, and i will read them.

    regards
    steviegee

  4. #4
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,379

    Re: Text and numbers

    Why not just use SUM ?

    =SUM(A1:B1)

    Non-numerics are simply ignored and the ranges need not be contiguous, ie:

    =SUM(A1:B1,D1,Z10:AA12,AD1)

  5. #5
    Registered User
    Join Date
    06-28-2007
    Posts
    31

    Re: Text and numbers

    Both formulas do the job,

    however how can i get rid of the "false" errors if there is no values or text in the cells?


    Thanks

  6. #6
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,379

    Re: Text and numbers

    Use SUM - it will simply return 0.

  7. #7
    Registered User
    Join Date
    06-28-2007
    Posts
    31

    Re: Text and numbers

    I understand what your saying, but i do need the cells that have no values or text to return a blank anwser,they a1&b1 will have no text or values, it will not just be 1 cell that has a value or text.

    basically it will be a block of data, then scroll down to find the next block of data.

    hope your understanding me.


    steviegee

  8. #8
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,379

    Re: Text and numbers

    No, I'm afraid I don't follow...

    If you want a Null

    =IF(COUNT(A1:B1),SUM(A1:B1),"")

    Alternatively if the SUM of A1:B1 will never genuinely be 0 then you can use SUM as before but apply a Custom Format on the cells containing the formulae of: General;;
    As such 0's display as Blanks.

  9. #9
    Registered User
    Join Date
    06-28-2007
    Posts
    31

    Re: Text and numbers

    Problem solved.


    Perfect.



    Many thanks


    Steviegee

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.2.0