+ Reply to Thread
Results 1 to 11 of 11

Comparing one cell to an entire column (SOLVED)

Hybrid View

knitterkuba Comparing one cell to an... 12-25-2010, 04:19 PM
watersev Re: Comparing one cell to an... 12-25-2010, 04:32 PM
knitterkuba Re: Comparing one cell to an... 12-25-2010, 04:51 PM
Marcol Re: Comparing one cell to an... 12-25-2010, 04:48 PM
Marcol Re: Comparing one cell to an... 12-25-2010, 05:29 PM
mikerickson Re: Comparing one cell to an... 12-25-2010, 05:33 PM
knitterkuba Re: Comparing one cell to an... 12-25-2010, 05:58 PM
Marcol Re: Comparing one cell to an... 12-25-2010, 06:12 PM
knitterkuba Re: Comparing one cell to an... 12-25-2010, 06:30 PM
Marcol Re: Comparing one cell to an... 12-25-2010, 07:29 PM
knitterkuba Re: Comparing one cell to an... 12-26-2010, 03:12 PM
  1. #1
    Registered User
    Join Date
    05-25-2010
    Location
    Florida
    MS-Off Ver
    Excel 2009
    Posts
    39

    Comparing one cell to an entire column (SOLVED)

    I'm just wondering what would be an easy formula to use if I am trying to compare B1 to A1:A10 and then if there is a cell matching in the A column then I want B1 to show that value but if there isn't one then I want it to be left blank.
    Last edited by knitterkuba; 12-26-2010 at 03:14 PM.

  2. #2
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Comparing one cell to an entire column

    do you want to see the first match only? In order to use formula it should be in a different cell. See attachment, try to change A13 cell value
    Attached Files Attached Files
    Last edited by watersev; 12-25-2010 at 04:40 PM.

  3. #3
    Registered User
    Join Date
    05-25-2010
    Location
    Florida
    MS-Off Ver
    Excel 2009
    Posts
    39

    Re: Comparing one cell to an entire column

    I should have clarified a little better. First, all of my values are strings of roman letters. I have values in A1:A10. In cell B1 I have I have a value. I suppose that in a separate cell I want to compare B1 to the values in A1:A10 (which happen to be unique). If the B1 value happens to appear anywhere in A1:A10 then I want that value to remain in cell B1 but if it does not then I want cell B1 to be blank.

  4. #4
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Comparing one cell to an entire column

    Try this workbook

    Change the value in D1

    You could write your search string directly in the formula, this is shown in B3

    Is this what you are after?
    Attached Files Attached Files
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  5. #5
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Comparing one cell to an entire column

    Does this help?

    In B1
    =MATCH(A1,ROMAN(ROW($1:$5000)),0)
    Enter with Ctrl+Shift+Enter
    Then Drag/Fill Down

    Or applied as shown in this workbook.
    Attached Files Attached Files
    Last edited by Marcol; 12-25-2010 at 05:45 PM. Reason: Added a few more examples to workbook

  6. #6
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Comparing one cell to an entire column

    A formula in some other cell cannot change the value in B1.
    Unless you want VB, you will be setting up a circular reference (error).
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  7. #7
    Registered User
    Join Date
    05-25-2010
    Location
    Florida
    MS-Off Ver
    Excel 2009
    Posts
    39

    Re: Comparing one cell to an entire column

    I feel like we're getting really close here. This is what I got so far with all of your help,
    =IF(MATCH(B2,A2:A12,0),B2,"")
    This is a formula in C3. I have a bunch of letters in cells A2 through A12. This is roughly how it looks:
    asd pol #N/A
    sdf
    dfg
    fgh
    ghj
    hjk
    jkl
    uio
    tyu
    rty
    ert

    This formula works great if C3 matches to something, the problem is that if it does not then I want C3 to not display anything but instead it gives me #N/A. I really appreciate everybody's help, especially now during holidays. Happy holidays to all.

  8. #8
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Comparing one cell to an entire column

    Did you try the formula I gave you in Post #3?

    Just enter your data in column A and adjust the formula to suit your range.

  9. #9
    Registered User
    Join Date
    05-25-2010
    Location
    Florida
    MS-Off Ver
    Excel 2009
    Posts
    39

    Re: Comparing one cell to an entire column

    I'm sorry I have not noticed it before. There are two formulas in there. The only difference between the two are the quotation marks, one has them and the other one does not. Which one applies better? Also, what is the difference between putting the quotation marks versus not putting them?

  10. #10
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Comparing one cell to an entire column

    Have a look at this work book for an explanation.

    I would use the method in Cell B2 refering to D2.

    If you use the method in Cell B5 you will need to change the formula every time you want a different lookup value.

    My choice of data in the original worksheet may have confused you, my apologies.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    05-25-2010
    Location
    Florida
    MS-Off Ver
    Excel 2009
    Posts
    39

    Re: Comparing one cell to an entire column

    And that works just as I want it to :D Thanks!!

+ 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