+ Reply to Thread
Results 1 to 2 of 2

How to combine data from 2 rows, possibly with IF statement involved.

  1. #1
    Registered User
    Join Date
    08-07-2012
    Location
    New York
    MS-Off Ver
    Excel 2003
    Posts
    1

    How to combine data from 2 rows, possibly with IF statement involved.

    I have a template with various columns to be filled, with the data being pulled from another data set (I have both in the same sheet for now and will just paste special values out later). Things gets complicated since the data set from which I'm taking data has the information in 2 rows, but the final template needs to have the info in one row. There is a common identifier with which I can match things (i.e. 2 rows of data to pull and each row has the common identifier). I have matched using this identifier but it does not work fully since I also need to tell Excel to pull from one of the 2 rows based on a conditional statement. I don't know how to do this but I'm guessing I have to nest IF statements here somewhere.

    For reference I am currently using: =INDEX($C$236:$W$451, MATCH($B$14,$C$236:$C$451,0),13)

    To help make it a bit clearer, each row in the data set is either Pay or Receive. And in the final template, it is one consolidated row with half of the columns being 'Pay' and half being 'Receive'. For the data set source, I think I need to match to the common identifier, and then if the first row is Pay pull the relevant data in this row to columns in the left/'Pay' side of the final template. Or if it's receive, pull it to the relevant columns on the right/'Receive' side of the final template.

    I have been trying to do this myself on and off for about 3 days now, so any help is greatly appreciated.

    Thanks!

  2. #2
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: How to combine data from 2 rows, possibly with IF statement involved.

    I think what you want is something like this:

    index_num = MATCH(input, array_C, FALSE)

    output = INDEX(matrix_CW, index_num, IF( INDEX(matrix_CW, index_num, pay_or_receive_column_num) = "pay", column_num_if_pay, column_num_if_receive) )

    Basically, use the IF to determine which column number in the matrix the INDEX is checking.

    Anyway, if I haven't answered what you were asking, then I'll need more to understand: in that case, please post a copy of the spreadsheet with a mock-up of what the desired state is.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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