+ Reply to Thread
Results 1 to 6 of 6

sum cells with text and formulas

  1. #1
    Registered User
    Join Date
    09-13-2011
    Location
    NYC
    MS-Off Ver
    Excel 2016
    Posts
    36

    sum cells with text and formulas

    I want to add cells that are using a formula with text
    =IF(B3>L3,B3-L3 & " under",L3-B3 &" over")

    so the formula gives me a column that looks like
    1 over
    2 under
    0 over
    0 over
    1 under

    I want to add these values up at the bottom to see how many I am off by. The sum formula does not work here though. What can I do? Thanks.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: sum cells with text and formulas

    Do you mean something like:

    =COUNTIF(C:C,"under")

    or:

    =SUMIF(C:C,"under",B:B)

    Hope this helps.

    Pete

    EDIT: Sorry, I didn't realise the numbers and texts were in the same column. How realistic are the values that you quote in your example? i.e. are they always single-digit values?

    Pete
    Last edited by Pete_UK; 09-04-2013 at 10:04 AM.

  3. #3
    Registered User
    Join Date
    06-15-2012
    Location
    Greece
    MS-Off Ver
    Excel 2007
    Posts
    85

    Re: sum cells with text and formulas

    If your data start in B2 for example, then you can use a helper and hidden column to get your results.

    So in C2 and copy down.

    =LEFT(B2)+0

    Then use =SUM(C2:C5)

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,860

    Re: sum cells with text and formulas

    Because you are mixing strings with numbers, you cannot add them.

    Suggest you change your If Statement to this: =IF(B3>L3,(B3-L3)*-1 ,L3-B3)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: sum cells with text and formulas

    if that totals to 2 under then
    =IF(SUM(L3:L10)-SUM(B3:B10)<0,ABS(SUM(L3:L10)-SUM(B3:B10))&" under",SUM(L3:L10)-SUM(B3:B10)&" over")
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    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

  6. #6
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: sum cells with text and formulas

    Perhaps
    =SUMPRODUCT(B3:B7-L3:L7)


    or reverse the ranges if a negative result is the Under..

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Cells with text calculating formulas
    By halgraham in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-11-2013, 03:49 PM
  2. [SOLVED] If then, else formulas when cells on various tabs are mix of text and numbers
    By lpdfsu in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-29-2013, 02:19 PM
  3. formulas to split text cells
    By glezer in forum Excel General
    Replies: 4
    Last Post: 09-22-2011, 11:51 AM
  4. Replies: 4
    Last Post: 01-17-2011, 01:00 PM
  5. [SOLVED] How do I convert cells containing formulas to text (value returned
    By Kim in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-28-2005, 05:06 PM

Tags for this Thread

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