+ Reply to Thread
Results 1 to 15 of 15

To Sum a range containing 3 text Characters then a number

  1. #1
    Forum Contributor
    Join Date
    01-21-2015
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    116

    To Sum a range containing 3 text Characters then a number

    Hi,

    I have struggled all day on this, in 1 column (B) I have a 10 rows of data containing initials then a number, like AAA8. I have a cell in A1 that contains the initials I want to query, like AAA.

    How can I sum all the numbers together (B1-B10), they may be present multiple times in the list. In this example I want the Number 9.

    A B
    1 aaa aaa6
    2 bbb3
    3 aaa3
    4 ccc1
    5 ddd3
    6 ggg5
    7 hgh5
    8 hsb2
    9 sjs3
    10 sns4

    =SUMPRODUCT((0&SUBSTITUTE(B1:B10,A1,""))+0) This works if all the initals in B1-B10 start with AAA.

    I have tried this =IF(LEFT(B1,3)=A1,((MID(B1,4,99))+0),0) but this only works for one row B1

    If someone can take a look and advise that would be great.

  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: To Sum a range containing 3 text Characters then a number

    This array* formula will do it:

    =SUM(IF(LEFT(B1:B10,LEN(A$1))=A$1,--SUBSTITUTE(B1:B10,A$1,"")))

    *An array formula needs to be committed using the keystrokes Ctrl-Shift-Enter (CSE), rather than the usual <Enter>

    Hope this helps.

    Pete

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,596

    Re: To Sum a range containing 3 text Characters then a number

    Try this.
    Confirmed with ctrl+shift+enter (Not just enter)

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    01-21-2015
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    116

    Re: To Sum a range containing 3 text Characters then a number

    Thank you so much! Never used array formulaes, are they as stable as normal ones?

    One side effect that if no initals are matched, how can i put a 0 value in.

    Thank you

  5. #5
    Forum Contributor
    Join Date
    01-21-2015
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    116

    Re: To Sum a range containing 3 text Characters then a number

    Thank you zbor, your method achieves this thank you all.

  6. #6
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,596

    Re: To Sum a range containing 3 text Characters then a number

    Yes, they are stable.
    They just evaluate whole array, rather than just one cell.

    Like SUMPRODUCT for example.
    It's also array function (only you don't need to enter it with ctrl+shift+enter)

  7. #7
    Forum Contributor
    Join Date
    01-21-2015
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    116

    Re: To Sum a range containing 3 text Characters then a number

    I have spend the whole day on this and you have solved it in minutes!! and I wonder if you could assist in the next step to finish it off.

    Instead of 1 column containing 10 rows, I actually have 365 columns. 1 for each day of year. B1 is 1/1/2015. B2-B11 has the rows of initials. B2 is 2/1/2015 etc

    The formula solves the value per day depending on initial how can i search the whole year between two dates say A2 with a start date and A3 with an end date.


    This works for a row but cant figure out how to include the formuale just given.

    =(COUNTIFS(standby,A1,dateyear,">="&$a$2,dateyear,"<="&$a$3)

    A1 contains the initials like aaa
    dateyear is the range of dates from 1/1/2015 to 31/12/2015
    standby is the range of the whole row that I wish to use your formaula.


    Thank you

  8. #8
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,596

    Re: To Sum a range containing 3 text Characters then a number

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

  9. #9
    Forum Contributor
    Join Date
    01-21-2015
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    116

    Re: To Sum a range containing 3 text Characters then a number

    Thank you for your time. Hopefully attached is the spreadsheet back to bare bones.
    Attached Files Attached Files

  10. #10
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,596

    Re: To Sum a range containing 3 text Characters then a number

    It's password protected.

  11. #11
    Forum Contributor
    Join Date
    01-21-2015
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    116

    Re: To Sum a range containing 3 text Characters then a number

    I am so sorry. Here the file is again.

    Help.xlsx

  12. #12
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: To Sum a range containing 3 text Characters then a number

    welcome to the forum. you could try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  13. #13
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,596

    Re: To Sum a range containing 3 text Characters then a number

    Just a not that in above solution is one criteria redundant so it should rather be:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    And in attachemnt are both solution: mine and benishiryo

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    They are different approaches so you might get different result in some different occasions (like there is no date from C3 in dateh1 or something).
    In that case mine would return 0 while benishiryo would still work.

    But now both return same value
    Attached Files Attached Files

  14. #14
    Forum Contributor
    Join Date
    01-21-2015
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    116

    Re: To Sum a range containing 3 text Characters then a number

    Thank you benishiryo and zbor so much for the help you have given. That works a treat.

  15. #15
    Forum Contributor
    Join Date
    01-21-2015
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    116

    Re: To Sum a range containing 3 text Characters then a number

    Hi zbor

    I think I will use yours as sometime there may be a blank value in the rows of data. Yours works where as benishiryo comes up with a value error.

    However his is case insensitive which is great. Can your formulae be modified to work if initials are entered in upper or lowercase?

    Thank you again in advance.

    Chris

+ 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] Extract certain text dependant on number of characters in text
    By bjoanmark in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-28-2014, 02:57 AM
  2. [SOLVED] Validating number of characters in a cell range
    By johnph in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 08-21-2012, 01:18 PM
  3. Wrap text after x number of characters
    By ccpsc in forum Excel General
    Replies: 1
    Last Post: 01-22-2012, 06:54 AM
  4. counting the number of characters in a cell w text
    By luv2glyd in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-19-2011, 12:59 PM
  5. Count the number of different characters in a range
    By aderougemont in forum Excel General
    Replies: 4
    Last Post: 01-12-2009, 11:36 AM

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