+ Reply to Thread
Results 1 to 6 of 6

Perform a function if value exists within predefined range

  1. #1
    Registered User
    Join Date
    07-05-2010
    Location
    London, England
    MS-Off Ver
    Excel 2013
    Posts
    40

    Perform a function if value exists within predefined range

    Hi,

    I need to perform a function if the value exists witin a predefined range. In matlab you'd probably use ANY but I cannot find an equivalent in excel.

    Any help or suggestions will be greatly appreciated!

    Many thanks,
    Bond002
    Attached Files Attached Files
    Last edited by bond002; 11-17-2011 at 12:06 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: Perform a function if value exists within predefined range

    something like?

    =IF(COUNTIF(A2:A11,B2),your_formula,"")
    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
    Forum Contributor
    Join Date
    05-27-2008
    Location
    Newcastle Upon Tyne UK
    MS-Off Ver
    XP Excel 2003
    Posts
    105

    Re: Perform a function if value exists within predefined range

    Having reread the question - I have not given a solution that would work.

    See NVBC above

    edvwvw
    Last edited by edvwvw; 11-17-2011 at 11:54 AM.

  4. #4
    Registered User
    Join Date
    07-05-2010
    Location
    London, England
    MS-Off Ver
    Excel 2013
    Posts
    40

    Re: Perform a function if value exists within predefined range

    Thanks guys.

    It's not that simple and I guess I should've been a bit clearer.

    NBVC: I tried the countif but it performs a true function regardless of the value existing or not exisiting within the range.

    edvwvw: The range of values is much bigger than the one in the example and it consits of different values (not necessarilly between 1 and 10 only). It could be, say 1,3,4,5,7,10,12 etc.

    Any ideas how to solve this?

    Cheers,
    Bond002
    Attached Files Attached Files

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

    Re: Perform a function if value exists within predefined range

    My formula is in C2.

    Change your number in B2 to 2, for example and see the result in C2.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    07-05-2010
    Location
    London, England
    MS-Off Ver
    Excel 2013
    Posts
    40

    Re: Perform a function if value exists within predefined range

    Works as a charm. Thank you!
    I have no idea why it didn't work when I tried this the first time. Must have made a typo in the formula.

+ 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