## Find max unique value from a range that have duplicate numbers and blanks

*Article updated on November 20, 2012*

**Array formula in cell D11:**

**Array formula in cell D12:**

**Formula in cell D15:**

**Formula in cell D16:**

**Array formula in cell G11:**

### Explaining array formula in cell D11

**Step 1 - Count the number of cells within a range that meet a given condition**

COUNTIF(Table1[Value],Table1[Value])

returns

{1;1;1;0;1;1;1;1;1;...}

**Step 2 - Check if value in array is a duplicate**

COUNTIF(Table1[Value],Table1[Value])<>1

becomes

{1;1;1;0;1;1;1;1;1;...}<>1

and returns

{FALSE;FALSE;FALSE;TRUE;FALSE;FALSE;FALSE;FALSE;FALSE;...}

** Step 3 - Check if table value is a blank**

(Table1[Value]="")

returns

{FALSE;FALSE;FALSE;TRUE;FALSE;FALSE;FALSE;FALSE;FALSE; ...}

**Step 4 - Return table value if conditions are met**

IF((COUNTIF(Table1[Value],Table1[Value])<>1)+(Table1[Value]=""),"",Table1[Value])

becomes

IF({FALSE;FALSE;FALSE;TRUE;FALSE;FALSE;FALSE;FALSE;FALSE; ...}, "", {72;373;230;0;311;424;460;418;665})

and returns

{72;373;230;"";311;424;460;418;665;...}

**Step 5 - Return max value**

MAX(IF((COUNTIF(Table1[Value],Table1[Value])<>1)+(Table1[Value]=""),"",Table1[Value]))

becomes

=MAX({72;373;230;"";311;424;460;418;665;...})

and returns 694 in cell D11.

### Download excel *.xlsx file

Find max unique value from a range that have duplicate numbers and blanks.xlsx

How to use a Table name in Data Validation Lists and Conditional Formatting formulas

David Hager gave this valuable comment about how to reference a table name in conditional formatting formulas: =INDIRECT("Table1[Start]") Watch this video to […]Extract unique distinct values from a filtered table [udf and array formula]

Robert Jr asks: Oscar, I am using the VBA code & FilterUniqueSort array to generate unique lists that drive Selection […]### Leave a Reply

**How to add a formula to your comment:**

<code>your formula</code>

Remember to convert less than and larger than signs to html character entities before you post your comment.

**How to add VBA code to your comment:**

[vb 1="vbnet" language=","]

VBA code

[/vb]

**How to add a picture to your comment:**

Upload picture to postimage.org

Add picture link to comment.

**Contact Oscar**

You can contact me through this webpage

## Share this article