+ Reply to Thread
Results 1 to 7 of 7

Summing numbers in a column range (X1...Xn) that may contain a non number character

  1. #1
    Registered User
    Join Date
    02-13-2021
    Location
    ottawa
    MS-Off Ver
    2017
    Posts
    10

    Summing numbers in a column range (X1...Xn) that may contain a non number character

    I've got an interesting problem:

    Given a column containing one of two possibilities:
    1. A Number
    2. Text that contains numbers with a single common character

    Get the sum of the column such that:
    1. The excel document can not use Scrips or Macros, since the document must be opened on an apple handheld device (example: IPAD, IPHONE) and due to apples "safety" policies, macros are disabled on such devices.
    2. The column containing said data is not modified in any way and
    3. cells that contain numbers with X single common character, where X is a character, include the numerical part of that text in the sum calculation

    I've attached a picture of an example:

    A.png

    But for example:

    if a column contains the following set of numbers [1,3,5,7,9,11#,13]:

    In column form:
    1
    3
    5
    7
    9
    11#
    13

    The sum of this set of numbers must return 49.

    A simple formula =SUM(x1:x:n), where n is a number, would not work since excel disregards cells that contain a mix of numbers + the "#" character.

    Thus the solution I need is to get a formula that would correctly get 49 and not 38.

    A formula I'm trying to use is incorrect since I'm using SUBSTITUTE which would modify the contents of the data which I'm not allowed to so.

    I may be approaching the problem incorrectly too, but it is:

    Please Login or Register  to view this content.
    The logic I have in mind is:
    1. If the sum of the column is <> 0, get the sum of the column THIS will return 38
    2. plus, If the cell contains "#", ignore "#" when summing for the total
    Last edited by skite0; 02-23-2021 at 01:39 PM. Reason: solution found

  2. #2
    Forum Expert
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    office 365 for MAC
    Posts
    3,105

    Re: Summing numbers in a column range (X1...Xn) that may contain a non number character

    Hi,
    Please upload an excel sheet. Look at the yellow banner at the top of the page for more instructions.

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

    Re: Summing numbers in a column range (X1...Xn) that may contain a non number character

    The SUBSTITUTE function will return a text value, so when you try to SUM the result it evaluates to zero.

    You could use this array* formula:

    =SUM(IF(ISNUMBER(O5:O12),O5:O12,--SUBSTITUTE(SUBSTITUTE(O5:O12,"#",""),"$","")))

    *Note that an array formula needs to be committed using the key combination of Ctrl-Shift-Enter (CSE), rather than the usual Enter.

    Hope this helps.

    Pete

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,996

    Re: Summing numbers in a column range (X1...Xn) that may contain a non number character

    You could try:

    =SUM(SUBSTITUTE(A1:A7,"#","")+0)
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,996

    Re: Summing numbers in a column range (X1...Xn) that may contain a non number character

    i forgot...

    You seem to be using an older version of Excel than me. So, please refer to the attached file (above). If the formulae are enclosed within a pair of { }, these are array formulae.

    These are a little different from ordinary formulae in that they MUST be confirmed in the FIRST CELL ONLY by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. After that, the array can be dragged down as normal, to cover the desired range.

    You will know the array is active when you see the curly brackets { } appear around the outside of your formula. If you do not use CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly brackets yourself - it won't work...

  6. #6
    Registered User
    Join Date
    02-13-2021
    Location
    ottawa
    MS-Off Ver
    2017
    Posts
    10

    Re: Summing numbers in a column range (X1...Xn) that may contain a non number character

    Quote Originally Posted by Glenn Kennedy View Post
    You could try:

    =SUM(SUBSTITUTE(A1:A7,"#","")+0)


    This was exactly what I needed, Thank you

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,996

    Re: Summing numbers in a column range (X1...Xn) that may contain a non number character

    You're welcome!!

+ 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. [SOLVED] Issue in summing up column numbers
    By ayenala01 in forum Excel General
    Replies: 6
    Last Post: 11-04-2020, 05:22 AM
  2. Check for Number in one column - then count specific numbers in a range.
    By CarlosM1 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 10-29-2014, 05:10 AM
  3. Help with formula summing numbers over date range
    By gabeha in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-13-2014, 02:16 AM
  4. Summing range of numbers according to variable dates
    By budapesh in forum Excel General
    Replies: 1
    Last Post: 05-26-2011, 05:46 PM
  5. Summing non zero numbers in a column.
    By kohaku in forum Excel General
    Replies: 4
    Last Post: 06-04-2009, 02:38 PM
  6. Summing a range of numbers in a list of numbers
    By gemnnsw in forum Excel General
    Replies: 3
    Last Post: 02-03-2008, 12:58 PM
  7. [SOLVED] Summing a column of Numbers
    By FLKULCHAR in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-07-2005, 02:05 AM

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