+ Reply to Thread
Results 1 to 12 of 12

Sum until text

  1. #1
    Registered User
    Join Date
    01-15-2015
    Location
    Albuquerque, nm
    MS-Off Ver
    2010
    Posts
    5

    Sum until text

    Hi im a newbie when it comes to formulas, Is there a way to sum a column up to a certain point then it stops?

    ___a______b
    1 _______30
    2 _______40
    3 _______50
    4 _______32
    5 text 21
    6 _______67
    7 _______82

    I need it to sum all of column B but only until row 5 when theres a text that shows up on column A. So it would be 30+40+50+32.
    I need the formula to stop wherever somebody puts text in column A.
    Last edited by azraeleyes; 10-25-2016 at 03:44 AM.

  2. #2
    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
    44,116

    Re: Sum until text

    Unless I'm mistaken (and I'm still only half awake...), this is not as easy as you might think. If your data are in A2 to A31, this will add all the numbers, until a text entry is made:

    =SUM($A$2:INDEX($A$1:$A$31,IFERROR(MATCH(VLOOKUP("*",$A$2:$A$31,1,FALSE),$A$2:$A$31,0),MATCH(LOOKUP(1E+100,$A:$A),$A$1:$A$31,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

  3. #3
    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
    44,116

    Re: Sum until text

    Simpler version:

    =IFERROR(SUM($A$2:INDEX($A$1:$A$31,MATCH(VLOOKUP("*",$A$2:$A$31,1,FALSE),$A$2:$A$31,0))),SUM($A:$A))

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,291

    Re: Sum until text

    Glenn - the OP has amended their opening post and I think the sum values are in column B, with the text value in A.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  5. #5
    Forum Contributor
    Join Date
    07-12-2015
    Location
    Dubai,UAE
    MS-Off Ver
    Office 365
    Posts
    425

    Re: Sum until text

    Quote Originally Posted by azraeleyes View Post
    Hi im a newbie when it comes to formulas, Is there a way to sum a column up to a certain point then it stops?

    ___a______b
    1 _______30
    2 _______40
    3 _______50
    4 _______32
    5 text 21
    6 _______67
    7 _______82

    I need it to sum all of column B but only until row 5 when theres a text that shows up on column A. So it would be 30+40+50+32.
    I need the formula to stop wherever somebody puts text in column A.


    Hi,

    Another version using OFFSET.

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


    File Attached.



    Regards
    Attached Files Attached Files

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,291

    Re: Sum until text

    I think it needs to be this:

    =SUM(OFFSET($B$2,0,0,MATCH("*",$A$2:$A$12,0)-1))

    because the row containing text should not be included.

  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
    44,116

    Re: Sum until text

    Ali, you're right. I'm out...

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,291

    Re: Sum until text

    Quote Originally Posted by Glenn Kennedy View Post
    Ali, you're right. I'm out...
    ... to get another coffee?

  9. #9
    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
    44,116

    Re: Sum until text

    First one of the day is whistling in the kettle right now.

  10. #10
    Registered User
    Join Date
    01-15-2015
    Location
    Albuquerque, nm
    MS-Off Ver
    2010
    Posts
    5

    Re: Sum until text

    Thanks! the offset formula worked perfectly! the file attached helped tremendously as well!

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,291

    Re: Sum until text

    You're welcome!

  12. #12
    Forum Contributor
    Join Date
    07-12-2015
    Location
    Dubai,UAE
    MS-Off Ver
    Office 365
    Posts
    425

    Re: Sum until text

    Quote Originally Posted by azraeleyes View Post
    Thanks! the offset formula worked perfectly! the file attached helped tremendously as well!

    Hi,

    Please don't forget to add rep for all those who helped.


    Regards

+ 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. Replies: 1
    Last Post: 12-17-2015, 03:35 AM
  2. [SOLVED] How to match a cell with text with a range of text and return own text
    By ec4excel in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-16-2014, 11:07 AM
  3. [SOLVED] Need to Mod Code on red text, I have VBA to distinguish Paid(Black Text) Unpaid(Red Text)
    By Garbology in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-11-2014, 07:55 PM
  4. [SOLVED] function IF to return text based if text contains exact text
    By in nomine noctis in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-05-2013, 06:25 AM
  5. Replies: 0
    Last Post: 04-22-2013, 12:13 PM
  6. Macro to Parse Text - Import text to Excel from Multiple Text Files & Folders
    By Novice_To_Excel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-02-2012, 01:05 AM
  7. [SOLVED] Use .text from previous text box in form to prefill text in second text box
    By chromachem in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-23-2012, 10:04 PM

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