+ Reply to Thread
Results 1 to 10 of 10

Retrieving a value based on comparison of multiple columns

  1. #1
    Registered User
    Join Date
    11-04-2014
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    4

    Retrieving a value based on comparison of multiple columns

    Hello all,

    I am having trouble with combining different datasets in excel, which I hope you could help me with!

    In our study, participants received feedback which they had to rate on usefulness. This resulted in two separate datasets: one with feedback received and one with feedback rated (which is not the same as the feedback received, as we have some missing data because participants did not rate all feedback).

    For example:

    Dataset 1
    name - feedback_date - feedback_received (code)
    john -------- 10/10/2014 ------- A1
    john -------- 11/10/2014 ------- A2
    john -------- 12/10/2014 ------- A3
    john -------- 13/10/2014 ------- A4
    mary ------- 10/10/2014 ------- A1
    mary ------- 11/10/2014 ------- A2
    mary ------- 12/10/2014 ------- A3
    mary ------- 13/10/2014 ------- A4

    Dataset 2
    name ---- feedback_date - feedback_received (code) - rating of feedback

    john -------- 10/10/2014 ---------------- A1 ---------------------- 2
    john -------- 12/10/2014 ---------------- A3 ---------------------- 7
    mary ------- 12/10/2014 ---------------- A3 ---------------------- 5
    mary ------- 13/10/2014 ---------------- A4 ---------------------- 4



    I want to combine these datasets so that the end result is that I have Dataset 1 with the ratings of the feedback added to it. To do this, I was thinking about comparing the data in these two datasets based on participant's name, the date the feedback was received, and the actual feedback that was received (which is coded). When these three variables are the same, I want the ratings to be added to the first dataset.
    This is the end result that I would like to get (empty rating lines are missing data):

    name - feedback_date - feedback_received - rating of feedback
    john ------------- 10/10/2014 ----------- A1 ----------- 2
    john ------------- 11/10/2014 ----------- A2
    john ------------- 12/10/2014 ----------- A3 ----------- 7
    john ------------- 13/10/2014 ----------- A4
    mary ------------ 10/10/2014 ----------- A1
    mary ------------ 11/10/2014 ----------- A2
    mary ------------ 12/10/2014 ----------- A3 ----------- 5
    mary ------------ 13/10/2014 ----------- A4 ----------- 4


    I have tried several things using the VLOOKUP statement, but first of all I am not very familiar with this command, and second of all I am not sure whether the VLOOKUP statement is able to compare several columns at once.

    I hope this is possible in Excel and I hope you guys can help me!

    Thanks,

    Rik

  2. #2
    Forum Contributor
    Join Date
    08-04-2014
    Location
    Riga
    MS-Off Ver
    2010
    Posts
    579

    Re: Retrieving a value based on comparison of multiple columns

    How about you copy/paste one dataset into another, sort all data (multiple levels, by name, then by date, then by feedback code if needed), then select the data range and click Remove Duplicates under the Data tab? I did not try this, just a quick idea.

  3. #3
    Registered User
    Join Date
    11-04-2014
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    4

    Re: Retrieving a value based on comparison of multiple columns

    Thanks for your reply!

    I have tried it out and if I understand you correctly it doesn't seem to work, as the columns are sorted together simultaneously, and the order of the two datasets are not changed independently and sorted per individual if I do that. I might be doing this wrong tho...

  4. #4
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: Retrieving a value based on comparison of multiple columns

    Hi,

    a sample file would be grate, a possinle approach could be SUMIFS


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


    it's just an example and for sure you have to adjust references: it sums values in column D if A2:A1000 = John B2:B1000= 10/10/2014...

    Hope this helps
    -----------------------------------------------------

    At Excelforum, you can say "Thank you!" by clicking the star icon ("Add Reputation") below the post.

    Please, mark your thread [SOLVED] if you received your answer.

  5. #5
    Forum Contributor
    Join Date
    08-04-2014
    Location
    Riga
    MS-Off Ver
    2010
    Posts
    579

    Re: Retrieving a value based on comparison of multiple columns

    Ok, I tested my solution, and the last part doesn't work, so scratch the Remove Duplicates. You could use Conditional Formatting to highlight the cells that you don't need to fill, because the feedback rating is already given in the next cell. For this you need a custom rule =IF(H6=H7;IF(I6<1; TRUE; FALSE))

    The rule works, but you cannot sort the data afterwards, because it messes with the rule.

  6. #6
    Registered User
    Join Date
    11-04-2014
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    4

    Re: Retrieving a value based on comparison of multiple columns

    Thank you for your reply as well! I will try move the formulas around a little bit.

    I also made a sample dataset as you suggested to show what I mean. The data on the left is the first dataset (including the feedback delivered), the data in the middle is the second dataset (including the ratings given), and the data on the right is the desired output (highlighted in grey).

    Best wishes,

    Rik
    Attached Files Attached Files

  7. #7
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: Retrieving a value based on comparison of multiple columns

    Hi ,

    in D2 and below:


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



    Regards

  8. #8
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: Retrieving a value based on comparison of multiple columns

    Hi,

    using a format to "blank" zero outputs (in the attached example I've set a customized format ), you could shorten a little the formula:

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



    Regards
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    11-04-2014
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    4

    Re: Retrieving a value based on comparison of multiple columns

    Awesome, that's working great. Thanks everybody for helping!

  10. #10
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: Retrieving a value based on comparison of multiple columns

    Hi,

    glad to help you: thanks for providing kind feedback.

    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. Comparison of columns with multiple data
    By JaWindham in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-11-2014, 02:48 PM
  2. Replies: 1
    Last Post: 05-09-2012, 08:14 AM
  3. combine cellcontents based on comparison multiple cells
    By scarm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-08-2011, 03:48 AM
  4. Text comparison between multiple columns
    By phanh in forum Excel General
    Replies: 1
    Last Post: 03-16-2008, 03:24 PM
  5. Matching multiple columns and retrieving a value
    By shzdug in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-09-2006, 05:49 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