+ Reply to Thread
Results 1 to 13 of 13

Look up across several columns (same row), and return value in another cell

  1. #1
    Registered User
    Join Date
    03-11-2009
    Location
    Seattle, WA
    MS-Off Ver
    Office 2007
    Posts
    58

    Look up across several columns (same row), and return value in another cell

    Hi

    I am trying to look up values in say 5 columns of each row, if the values are the same in each column, return that value to another cell.
    If the values are not the same, return a special character like "*"

    Example:
    1.Look up a name in Sheet1, A2, in Sheet2 cells A2,B2,C2,D2,E2
    2. If the values in A2,B2,C2...are the same, return that value to Sheet 1, cell B2
    3. If the vlaues are different, return "*" in Sheet 1 B2

    Basically, I'm looking up names in Sheet1, and looking for the point values in Sheet2, so that if they are all the same, I'll have that number returned to Sheet1 or a "*" to denote that the points are not the same.

    Thank you for any help on this.

    Dan
    Last edited by Dannypak; 12-13-2012 at 03:19 PM. Reason: Solved!!

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,973

    Re: Look up across several columns (same row), and return value in another cell

    you could probably build something around a countif(), but hard to say without seeing a sample workbook

    To best describe or illustrate your problem you would be better off attaching a dummy workbook. The workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Contributor
    Join Date
    11-11-2012
    Location
    Muscat, Oman
    MS-Off Ver
    Office 365
    Posts
    521

    Re: Look up across several columns (same row), and return value in another cell

    Please check if this is what you are looking for:

    A B C D E F G H I J K
    1 Name Col1 Col 2 Col3 Col4 Col5 Name Result
    2 ABC 1 1 1 1 1 ABC 1
    3 ABC 1 2 1 2 1 DEF *
    4 DEF 1 1 1 1 1
    5 DEF 1 2 1 2 1
    6
    7 "=IF(AND((B9=K9),C9=D9,C9=E9,C9=F9,C9=G9),C9,"*")"
    8 Formula in column K

  4. #4
    Registered User
    Join Date
    03-11-2009
    Location
    Seattle, WA
    MS-Off Ver
    Office 2007
    Posts
    58

    Re: Look up across several columns (same row), and return value in another cell

    Hi There,

    I loaded a sample worksheet, wherer I need to Lookup column "D" in "Participation Sheet" and fill in the Column H (in yellow highlight) with a number or "*" if the numbers in the "particiaption" worksheet is not all the same for each row.


    Thanks again!
    Attached Files Attached Files

  5. #5
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Look up across several columns (same row), and return value in another cell

    In your example, in H3 copied down

    =IFERROR(IF(COUNTIF(INDEX(Participation!$C$5:$K$11,MATCH(D3,Participation!$A$5:$A$11,0),),VLOOKUP(D3,Participation!$A$5:$C$11,3,FALSE))=9, VLOOKUP(D3, Participation!$A$5:$C$11,3,FALSE),"*"),"")
    Does that work for you?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  6. #6
    Registered User
    Join Date
    03-11-2009
    Location
    Seattle, WA
    MS-Off Ver
    Office 2007
    Posts
    58

    Re: Look up across several columns (same row), and return value in another cell

    Totally Awesome!!! Perfect!

  7. #7
    Forum Contributor
    Join Date
    11-11-2012
    Location
    Muscat, Oman
    MS-Off Ver
    Office 365
    Posts
    521

    Re: Look up across several columns (same row), and return value in another cell

    @ChemistB..... wowwww coz i am still thinking and working on it and was half way through when i saw ur post.... have already clicked my star on ur post

  8. #8
    Forum Contributor
    Join Date
    11-11-2012
    Location
    Muscat, Oman
    MS-Off Ver
    Office 365
    Posts
    521

    Re: Look up across several columns (same row), and return value in another cell

    I thought i joined the forum to learn VBA but it seems my excel still needs to be where it should be

  9. #9
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Look up across several columns (same row), and return value in another cell

    Thanks Danny and VKS.
    VKS, don't worry about it, I still learn new ways to use Excel here all the time.

  10. #10
    Registered User
    Join Date
    03-11-2009
    Location
    Seattle, WA
    MS-Off Ver
    Office 2007
    Posts
    58

    Re: Look up across several columns (same row), and return value in another cell

    ChemistB,(and VKS)
    Thanks again...
    1. can't seem to find the "Star" to click on...
    2. I noticed that if there is a blank instead of a number, it's returning the "*", is there a way to have this formula ignore the blanks?

    dan

  11. #11
    Forum Contributor
    Join Date
    11-11-2012
    Location
    Muscat, Oman
    MS-Off Ver
    Office 365
    Posts
    521

    Re: Look up across several columns (same row), and return value in another cell

    Hello Dannypak,
    Check the attached file, you may like it.
    It has one additional column at the end(In participation sheet).
    This takes care of the missing values of column D(Region sheet) in participation sheet also.
    Attached Files Attached Files
    Last edited by VKS; 12-14-2012 at 01:02 AM.

  12. #12
    Registered User
    Join Date
    03-11-2009
    Location
    Seattle, WA
    MS-Off Ver
    Office 2007
    Posts
    58

    Re: Look up across several columns (same row), and return value in another cell

    Yeah! That's very cool too!

    Thank you, Thank you!!

  13. #13
    Forum Contributor
    Join Date
    11-11-2012
    Location
    Muscat, Oman
    MS-Off Ver
    Office 365
    Posts
    521

    Re: Look up across several columns (same row), and return value in another cell

    Glad you liked it Danny.
    Dont forget to mark it solved and if you want you can click on the star at the bottom of the post

+ 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