+ Reply to Thread
Results 1 to 3 of 3

Array Formula in If Then Statement

Hybrid View

nivoe Array Formula in If Then... 12-06-2012, 09:26 AM
StephenR Re: Array Formula in If Then... 12-06-2012, 09:34 AM
nivoe Re: Array Formula in If Then... 12-06-2012, 09:50 AM
  1. #1
    Registered User
    Join Date
    10-11-2012
    Location
    switzerland
    MS-Off Ver
    Excel 2010
    Posts
    38

    Array Formula in If Then Statement

    Hello everyone

    What I want to do is to check wheter there are duplicates in a range.
    As a formula, it is very easy. E.g. the range "A1:A10":

    {=MAX(COUNTIF($A$1:$A$10;$A$1:$A$10))>1}

    The above formula is not counting blanks, which is on purpose.

    Now I want all that in VBA, which is causing some pain as I have no experience with anything but regular formulas in VBA.
    From my level of knowledge, I'd like to achieve something like this:

    If Application.?{=MAX(COUNTIF($A$1:$A$10;$A$1:$A$10))>1}? Then
    	MsgBox = "blabla"
    	Exit Sub
    EndIf
    The part between the ? obviously doesn't work like this
    My question would be: Is there a solution in one line?

    I could use Range.FormulaArray and create a dummy range for this, but I'd love to have a solution in one line, so that I can put it between If ... Then.

    Any ideas or suggestions?
    It might have to do with R1C1 or something like that. A term that popped up some times while checking the internet.
    Unfortunately, I have no idea what the logic is behind this.

    Thanks in advance

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Array Formula in If Then Statement

    Try this:
    If Evaluate("MAX(COUNTIF($A$1:$A$10,$A$1:$A$10))") > 1 Then

  3. #3
    Registered User
    Join Date
    10-11-2012
    Location
    switzerland
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Array Formula in If Then Statement

    Great, it's working ... thank you so much

+ 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