+ Reply to Thread
Results 1 to 14 of 14

If 2 2 2 2 formula

  1. #1
    Forum Contributor
    Join Date
    09-04-2018
    Location
    cyprus
    MS-Off Ver
    2007
    Posts
    280

    If 2 2 2 2 formula

    hi to all, what I need is formula at B2 which work like: if 2 comes four times in a row (2222) show number 13(thirteen) in B1.i hope is easy fo you
    Last edited by louis128; 01-14-2019 at 10:03 AM.

  2. #2
    Forum Contributor
    Join Date
    09-04-2018
    Location
    cyprus
    MS-Off Ver
    2007
    Posts
    280

    Re: If 2 2 2 2 formula

    have a look to the attached file,thank you
    Last edited by louis128; 01-14-2019 at 09:45 AM.

  3. #3
    Valued Forum Contributor
    Join Date
    10-13-2010
    Location
    UK
    MS-Off Ver
    various
    Posts
    972

    Re: If 2 2 2 2 formula

    something like:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    note: array entry requirement

  4. #4
    Forum Contributor
    Join Date
    09-04-2018
    Location
    cyprus
    MS-Off Ver
    2007
    Posts
    280

    Re: If 2 2 2 2 formula

    is working!!thank you ,can we modify like that:if any other results shoe zero)?
    Last edited by louis128; 01-14-2019 at 11:02 AM.

  5. #5
    Valued Forum Contributor
    Join Date
    10-13-2010
    Location
    UK
    MS-Off Ver
    various
    Posts
    972

    Re: If 2 2 2 2 formula

    Not sure I follow your last question, sorry... if you're saying you want to return something other than 0 if there is no run of four consecutive 2s then yes, you could amend to:

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    09-04-2018
    Location
    cyprus
    MS-Off Ver
    2007
    Posts
    280

    Re: If 2 2 2 2 formula

    sorry Xlent, iwas not clear , imean if 2 2 2 2 show 13 as you made but if any other combination show zero, all the rest combinations(like 12231112231313232) the formula to show zero

    sorry my engilsh are not so good!!

  7. #7
    Valued Forum Contributor
    Join Date
    10-13-2010
    Location
    UK
    MS-Off Ver
    various
    Posts
    972

    Re: If 2 2 2 2 formula

    do not apologise - your English is far better than my Greek (and/or Turkish!)

    the first formula should return 0 if no 2-2-2-2 sequence is found, the second formula would allow you to return whatever you wanted (if you did not want 0)

    if still not clear please post a sample to explain, and which includes the formulas suggested (to show why they do not work).

  8. #8
    Forum Contributor
    Join Date
    09-04-2018
    Location
    cyprus
    MS-Off Ver
    2007
    Posts
    280

    Re: If 2 2 2 2 formula

    is clear! formula should return 0 if no 2-2-2-2 sequence is found,iam Greek.thank you so much

  9. #9
    Forum Expert Sambo kid's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    Office Professionsl Plus 2016- work; 2012 for Mac at home
    Posts
    5,415

    Re: If 2 2 2 2 formula

    based on your last post (#8) (and I haven't tested XLent's formula nor opened your workbook) but if you want it to return 0 instead of "something else" I would say to adjust it this way....
    =IF(MAX(FREQUENCY(IF(A1:A47=2,ROW(A1:A47)),IF(A1:A47<>2,ROW(A1:A47))))>=4,13,0)

    confirmed with CTRL + SHIFT + ENTER
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam C

  10. #10
    Valued Forum Contributor
    Join Date
    10-13-2010
    Location
    UK
    MS-Off Ver
    various
    Posts
    972

    Re: If 2 2 2 2 formula

    @SamboKid,

    Per post 7, an IF only required if a non-0 alternative is desired - i.e. post 3 can only return one of 13 or 0 - so above entirely redundant.
    Last edited by XLent; 01-14-2019 at 02:01 PM. Reason: post #3 rather than #2

  11. #11
    Forum Expert Sambo kid's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    Office Professionsl Plus 2016- work; 2012 for Mac at home
    Posts
    5,415

    Re: If 2 2 2 2 formula

    As I noted, I wasn't testing anything, I was just guessing. Wasn't sure the OP had their answer so I thought I'd post a guess still giving you credit.
    If they got their answer, great.

  12. #12
    Forum Contributor
    Join Date
    09-04-2018
    Location
    cyprus
    MS-Off Ver
    2007
    Posts
    280

    Re: If 2 2 2 2 formula

    thanks guys!!!

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    Excel 2016 (Win 10 - Work) & 365 Subscription (Win 10 - Home)
    Posts
    30,571

    Re: If 2 2 2 2 formula

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!

    Forum Rules (updated September 2018): please read them here.
    How to use the Power Query code you've been given: help here. More about the Power suite here.
    Don't forget to say "thank you" to those who have helped you in your thread. If you wish, you can also reward them by clicking on their reputation star bottom left.

  14. #14
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 2000/3/7/10/13/16
    Posts
    47,832

    Re: If 2 2 2 2 formula

    welcome to the forum

    For future reference, please take a moment to read the forum rules and use thread titles that are descriptive of your problem - not what you think the answer might be. (think google search terms?).

    Many members search our previous posts, and thread titles play a big part of the search. I doubt anybody would do a search based on your title?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ 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