+ Reply to Thread
Results 1 to 4 of 4

Dynamic Comparator?

  1. #1
    Registered User
    Join Date
    10-17-2013
    Location
    Mississauga, Ontario
    MS-Off Ver
    Excel 2003
    Posts
    3

    Dynamic Comparator?

    Is there a way that you can reference another cell that contains a comparator (< , > , <= , etc) in a formula and use that referenced cell as the comparator as a in an IF statement?

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Dynamic Comparator?

    Hi,

    Assuming that A1 and B1 contain your values (presumed numerical) to be compared, and C1 contains one of the comparators "<", "=" or ">", this formula will return TRUE if the relationship of A1 to B1 with respect to the comparator in C1 is true:

    =IF(SUMPRODUCT(COUNTIF(C1,"*"&{"<","=",">"}&"*")*(SIGN(B1-A1)+{0,1,2}=1)),TRUE)

    (courtesy of mik erickson)

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: Dynamic Comparator?

    I did something similiar to that; I couldn't figure it out how to directly feed it the value, so I did something circuitous:

    Ran a double nested IF() to see whether A = B and then whether A > B to deliver 1, 2, or 3; and then used 1,2,3 and the input logical operator as the axises of a lookup table to deliver a T/F to another IF.

    It's pretty kludgy, but I think it completely covers all possible bases???
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    10-17-2013
    Location
    Mississauga, Ontario
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Dynamic Comparator?

    Thanks! I tried both of the above and they work. I like the first solution the best because you dont need to set up any truth tables which is important when comparing large amounts of data

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. PDF Comparator
    By kiran527 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-25-2012, 01:45 PM
  2. Dynamic Range Column Chart w/ Dynamic Avg Line (Excel 2007)
    By BrokenBiker in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 10-04-2012, 11:40 AM
  3. Replies: 0
    Last Post: 02-28-2006, 09:10 PM
  4. Replies: 0
    Last Post: 02-28-2006, 09:10 PM
  5. [SOLVED] Dynamic Range with unused formula messing up x axis on dynamic graph
    By cabybake@yahoo.com in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 02-02-2006, 04:10 PM

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