+ Reply to Thread
Results 1 to 4 of 4

Combine Columns Based on Criteria

  1. #1
    Registered User
    Join Date
    10-03-2013
    Location
    CA
    MS-Off Ver
    Excel 2021
    Posts
    9

    Combine Columns Based on Criteria

    I have a table with columns for certain states. Each state belongs to a certain area. I now need to combine the columns for each area into one column and add the values for the rows where an input criteria is met. How do I do this? Here is an example:

    Table to be combined:

    Criteria CA CT NJ NV NY
    Q1/13 c1 2 3 4 5 3
    Q1/13 c2 4 3 4 2 6
    Q2/13 c1 4 3 6 3 3
    Q2/13 c2 2 4 3 5 3
    Q3/13 c1 4 3 4 2 5
    Q3/13 c2 3 5 2 5 3
    Q4/13 c1 2 4 3 3 4
    Q4/13 c2 3 2 4 3 4

    Inputs:
    Area1 CA,NV
    Area2 CT,NJ,NY
    Criteria c1

    Result:
    Area1 Area2
    Q1/13 ? ?
    Q2/13 ? ?
    Q3/13 ? ?
    Q4/13 ? ?
    Last edited by halama; 11-14-2013 at 03:36 PM.

  2. #2
    Forum Expert RobertMika's Avatar
    Join Date
    06-22-2009
    Location
    Haverhill, UK
    MS-Off Ver
    Excel 2003-13
    Posts
    1,530

    Re: Combine Columns Based on Criteria

    sum.xlsx
    Please see attached.
    =SUM(IF(ISNUMBER(SEARCH($C$1:$G$1,B$12)),IF($B$2:$B$9=$B$14,IF($A$2:$A$9=$A18,$C$2:$G$9))))
    Confirm Control+Shift+enter
    If you are http://www.excelforum.com/image.php?type=sigpic&userid=125481&dateline=1392355029happy with the results, please add to the contributor's
    reputation by clicking the reputation icon (star icon).




    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.
    To undo, select Thread Tools-> Mark thread as Unsolved.
    http://www.excelaris.co.uk

  3. #3
    Registered User
    Join Date
    10-03-2013
    Location
    CA
    MS-Off Ver
    Excel 2021
    Posts
    9

    Re: Combine Columns Based on Criteria

    Robert, I really appreciate your response and it works fine. However, I don't quite understand it. I did read up on array formulas but my understanding is that the array dimensions all need to match. In this case there is a 2D size as well as columns and rows each with different number of entries. I don't quite understand how this thing is being evaluated with these different dimensions.

  4. #4
    Forum Expert RobertMika's Avatar
    Join Date
    06-22-2009
    Location
    Haverhill, UK
    MS-Off Ver
    Excel 2003-13
    Posts
    1,530

    Re: Combine Columns Based on Criteria

    In this case you have one vertical and one horizontal array and a matrix for data.
    If you fallow the steps(Use Evaluate Formula toll) you will see that we have here multiplication of ranges.
    Anything which is on crosses of those two arrays is being added up.

    Please leave reputation if you happy with the answer.

+ 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: 3
    Last Post: 02-22-2013, 11:28 AM
  2. [SOLVED] Combine Several Cells into a New Cell Based on Criteria
    By Exia in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-14-2012, 06:15 PM
  3. Replies: 1
    Last Post: 02-13-2012, 08:08 PM
  4. Replies: 2
    Last Post: 12-03-2011, 03:51 AM
  5. Combine muliple rows into one based on criteria
    By smb2004 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-08-2007, 10:38 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