+ Reply to Thread
Results 1 to 11 of 11

check for a value in a range

Hybrid View

m_k check for a value in a range 11-12-2011, 03:13 AM
pike Re: check for a value in a... 11-12-2011, 03:52 AM
m_k Re: check for a value in a... 11-12-2011, 05:01 AM
pike Re: check for a value in a... 11-12-2011, 05:39 AM
m_k Re: check for a value in a... 11-12-2011, 06:34 AM
pike Re: check for a value in a... 11-12-2011, 10:53 PM
m_k Re: check for a value in a... 11-12-2011, 11:40 PM
pike Re: check for a value in a... 11-12-2011, 11:44 PM
m_k Re: check for a value in a... 11-13-2011, 12:04 AM
pike Re: check for a value in a... 11-13-2011, 12:04 AM
pike Re: check for a value in a... 11-13-2011, 01:54 AM
  1. #1
    Registered User
    Join Date
    10-30-2011
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    22

    check for a value in a range

    I have a VBA program which applies a loop in a range for eg B1:B60 and then checks for Y and N in a Column and values of another column having that Y is displayed in a listbox.

    Now what i require is that rather than loop applying for a range it should check for a value so that automatic updation can occur.

    This means suppose B column has values in the form of One Two or Three so if add row with One in B Column then automatically programs adjusts it.

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: check for a value in a range

    Welcome to the forum

    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.

    If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.

    Doing this will ensure you get the result you need!
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Registered User
    Join Date
    10-30-2011
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: check for a value in a range

    i have attached a dummy

    Making two combo boxes displaying "class" and then selecting "Good Cs" "Goodb" "Attentive". Displaying the names satisfying the criteria. Meaning if i select class - One and then Attentive, display all names satisying that criteria.

    If i want to add another new entry, it should automatically adjusts itself in the program and i don not have to change the code for that.
    Attached Files Attached Files

  4. #4
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: check for a value in a range

    Hi m_k
    Can you add a before and after sheet in the workbook
    I'm a little lost with what you need

  5. #5
    Registered User
    Join Date
    10-30-2011
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: check for a value in a range

    Just to tell you series of steps to make it clear

    1.Two combo boxes with first one having values of classes that is "One", "Two" and "Three".
    the second one having values - "GoodCs", Goodb" and "Attentive".
    2.Now suppose i select "One" from the first combobox and "Attentive" from the second combo box, it should display the corresponding names from column A having there classes as "One" and Y in the "Attentive" column. Listbox might display the result.
    3.Now if i add another row of data then listbox should print the names checking the newly added row as well.

  6. #6
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: check for a value in a range

    Hi m_k
    I think this is it
    a two value matrix lookup with multiple values

    =IF(ISERROR(INDEX($A$1:$C$100,SMALL(IF(($B$1:$B$100=$G$1)*(OFFSET(B$1:B$100,0,MATCH(H$1,C$1:E$1,0))="Y"),ROW($B$1:$B$100)),ROW(G1:I1)),1)),"",INDEX($A$1:$C$100,SMALL(IF(($B$1:$B$100=$G$1)*(OFFSET(B$1:B$100,0,MATCH(H$1,C$1:E$1,0))="Y"),ROW($B$1:$B$100)),ROW(G1:I1)),1))
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    10-30-2011
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: check for a value in a range

    Thanx for this method, it works but can you work around by using Excel VBA that might be great.

  8. #8
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: check for a value in a range

    hi m_k
    Why VBA? its only for if it cant be done with worksheet function

  9. #9
    Registered User
    Join Date
    10-30-2011
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: check for a value in a range

    Yes, but it would be great if u help in this with VBA.

  10. #10
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: check for a value in a range

    OK vba it is

  11. #11
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: check for a value in a range

    Try this example
    Attached Files Attached Files

+ 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