+ Reply to Thread
Results 1 to 7 of 7

Complex formula getting moer complex

  1. #1
    Forum Contributor
    Join Date
    06-29-2016
    Location
    Bristol, England
    MS-Off Ver
    2007
    Posts
    355

    Complex formula getting moer complex

    Hi again all

    Some time ago you helped me with a formula

    =IF((H223="L")+(N223="L")+(T223="L")=1,"L",IF((H223="L")+(N223="L")+(T223="L")>1,"LL",""))

    This tests 3 cells, in H, N, and T for "L" and returns L or LL or null, depending on how many there are.

    It works nicely and thanks for the help.

    I now need to extend this to test for "X" as well, (returning L as before). I could simply extend the IF with an OR statement, or I could use the Find function to check for either L or X in each cell. I know how to do this, but either will give me a messy function.

    Before I start, does anyone see a more elegant way of doing it ?

    Hope this is clear? Thanks, KK

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,036

    Re: Complex formula getting moer complex

    Will you please attach a SMALL sample Excel workbook (10-20 rows of data is usually enough)? Please don't attach a picture of one (no-one will want to re-type all your stuff before starting).

    1. Make sure that your sample data are truly REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential information is removed first!!

    4. Try to avoid using merged cells. They cause lots of problems!

    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Complex formula getting moer complex

    Hi,

    Perhaps this
    =REPT("L",MIN(2,OR(H223={"L","X"})+OR(N223={"L","X"})+OR(T223={"L","X"})))
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  4. #4
    Forum Contributor
    Join Date
    06-29-2016
    Location
    Bristol, England
    MS-Off Ver
    2007
    Posts
    355

    Re: Complex formula getting moer complex

    Hi, I won't pretend to understand this function, but I'll give it a try. K

  5. #5
    Forum Contributor
    Join Date
    06-29-2016
    Location
    Bristol, England
    MS-Off Ver
    2007
    Posts
    355

    Re: Complex formula getting moer complex

    I haven't the slightest idea why, but this formula works, deep respect. K

  6. #6
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Complex formula getting moer complex

    Breaking it down
    OR(H223={"L","X"})
    returns True if H223 equals either L or X and False otherwise. The formula is the same for the other two cells. These True/False values are then added together, converting True to 1 and False to 0, as in your original formula. This will produce a value between 0 and 3. The MIN part reduces the possible outcome to a value between 0 and 2.

    REPT repeats a given text a particular number of times. In this case the letter L is repeated the number of times specified by the outcome above- i.e. 0, 1 or 2 times- which produces the output you asked for, namely "", "L" or "LL" respectively.

    Does that help to clarify the formula?

  7. #7
    Forum Contributor
    Join Date
    06-29-2016
    Location
    Bristol, England
    MS-Off Ver
    2007
    Posts
    355

    Re: Complex formula getting moer complex

    You must have an astonishing grasp of excel, and yes I begin to see it. Many thanks. K

+ 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. too complex formula
    By Bab1 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-08-2014, 08:29 AM
  2. Complex lookup (complex for me...)
    By blacryan84 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-28-2014, 04:26 AM
  3. Replies: 4
    Last Post: 02-03-2014, 12:47 AM
  4. Need help with complex formula!
    By bcoluc1 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-20-2013, 02:07 AM
  5. Complex Formula using IF THEN ELSE!
    By daymaker in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-05-2011, 01:10 AM
  6. complex formula?
    By spinkung in forum Excel General
    Replies: 1
    Last Post: 12-22-2009, 05:20 AM
  7. [SOLVED] Complex Index Match Help (or at least complex to me)
    By Jennifer Reitman in forum Excel General
    Replies: 3
    Last Post: 08-10-2006, 03:55 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