+ Reply to Thread
Results 1 to 3 of 3

how to compare two columns and return a value (probably a VLOOKUP issue?)

  1. #1
    Registered User
    Join Date
    09-12-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    5

    how to compare two columns and return a value (probably a VLOOKUP issue?)

    Hi all,
    I am trying to compare two columns--one includes 4 types of stimuli (angry, happy, surprise, disgust) with another column which includes 6 possible responses (same 4 affects and 'none' or 'other'). I want to generate a unique value (1 thru 24) for each possible combination in the next column. For example (in my attached file), column D2: angry, column G2: angry, than H2: 1, if column G were disgust then return 2, etc.
    I believe I have too many conditions for an if (and) function and should probably use a VLOOKUP procedure? Any nudges in the right direction would be most welcome! I've attached a sample file.
    Attached Files Attached Files
    Last edited by quirk; 09-19-2012 at 09:02 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: how to compare two columns and return a value (probably a VLOOKUP issue?)

    Will this work?

    =IF(COUNTIFS(D$2:D2,D2,G$2:G2,G2)=1,MAX(H$1:H1)+1,INDEX(H$1:H1,MATCH(1,INDEX((D$1:D1=D2)*(G$1:G1=G2),0),0)))

    copied down
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    09-12-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: how to compare two columns and return a value (probably a VLOOKUP issue?)

    Thanks very much NBVC! This will work perfectly.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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