+ Reply to Thread
Results 1 to 3 of 3

Sum column B until column A text changes

  1. #1
    Registered User
    Join Date
    09-01-2011
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    78

    Sum column B until column A text changes

    I have two columns. Column A & Column B. Column A is either "buy" or "sell." Column B is some arbitrary number.

    I want to sum column B until Column A changes its value.

    E.g.

    A B
    Buy 5
    Buy 1
    Buy 4
    Sell 3
    Buy 2
    Sell 4
    Sell 4


    Should become

    A B
    Buy 10
    Sell 3
    Buy 2
    Sell 8

    I'm going to build it out to something more complex later which includes multiple columns but it's all based on this idea of doing some operation until the Column value changes.

    Any suggestions or ideas?
    Last edited by labogola; 03-19-2019 at 11:17 PM.

  2. #2
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,923

    Re: Sum column B until column A text changes

    Try
    HTML Code: 

  3. #3
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    1,009

    Re: Sum column B until column A text changes

    Try this:

    Please Login or Register  to view this content.
    The Result:

    Excel 2013 32 bit
    A
    B
    C
    D
    E
    1
    Buy
    5
    Buy
    10
    2
    Buy
    1
    Sell
    3
    3
    Buy
    4
    Buy
    2
    4
    Sell
    3
    Sell
    8
    5
    Buy
    2
    6
    Sell
    4
    7
    Sell
    4
    Sheet: Sheet2

+ 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. VBA: Look for partial text in Column A from Column B and paste text offset Column A
    By coryspeth in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-07-2018, 05:53 AM
  2. [SOLVED] Macro to Copy and Paste Specific Text in Column A on the last line with Text in Column B?
    By D2S in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-18-2017, 04:08 PM
  3. [SOLVED] VBA Macro to find text string in one column and replace specific text in another column if
    By bmahfood in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-21-2017, 11:15 AM
  4. [SOLVED] If text in column A matches text in column B then use data from column C
    By kemble in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 06-08-2016, 02:03 PM
  5. Filter column by text, then export column to new workbook, replace searched text with new.
    By Headhunter234 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-30-2015, 07:48 AM
  6. Lookup text in Column A in Column B and return text in Column A
    By roshnidutt in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-05-2013, 05:14 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