Count cell with a certain criteria if adjacent cell is a unique value

sublimemovement

New Member
Joined
Dec 26, 2012
Messages
4
I am trying to count cell with a certain criteria if adjacent cell is a unique value.

Example:
Age (Days)Purchase Order
9020151237
2720151236
320151235
320151235
020151234

<tbody>
</tbody>

I only need to count 1 value from the age column if the Purchase Order column is unique.

The desired result:
Less than 14 days14 to 30 daysgreater than 30
211

<tbody>
</tbody>


I can manage to get the unique number for the Purchase order column and count my ranges for the age column but I cant mix the 2.

Thanks in advance for all help.
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Here's one way. Each purchase order will be counted 1 time, no matter how many times it's in the list. If it's in 2 data ranges, it will still only be included in one range.

Excel 2010
AB
1Age (Days)Purchase Order
29020151237
32720151236
4320151235
5320151235
6020151234
7
8
9Under 14 days2
1014-30 days1
11Over 30 days1

<tbody>
</tbody>
Sheet20

Array Formulas
CellFormula
B9:B11{=FREQUENCY(IF(MATCH(B2:B6,B2:B6,0)=ROW(B2:B6)-1,A2:A6),{14,30})}

<tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>



This is a somewhat unusual use of an array formula. Select the cells B9:B11 (all 3 of them at the same time), then enter the formula and confirm it with Control-Shift-Enter. Note that to use this formula the result cells must be vertical.

Let me know if this works.
 
Last edited:
Upvote 0
Eric,
I get a return of "#N/A" The only thing I change is the range and I take out the curly brackets before entering with "Ctrl+Shift+Enter"

Using my example in OP I get the individual results using the following formulas.

Under 14 Days: =COUNTIF(A:A, "<13")
14-30 Days: =COUNTIFS(A:A, ">13",A:A, "<31")
Over 30 Days: =COUNTIF(A:A, ">30")

Count Unique values: =SUMPRODUCT((B:B<>"")/COUNTIF(B:B,B:B&""))-1

I am trying to count unique values the count what values meet the criteria for the 3 ranges.
 
Upvote 0
Row\Col
A​
B​
C​
D​
E​
F​
1​
Age (Days)Purchase Order
2​
90
20151237
-9.99E+307
14
30
3​
27
20151236
14
30
9.99E+307
4​
3
20151235
2​
1​
1​
5​
3
20151235
6​
0
20151234

In D4 control+shift+enter, not just enter, and copy across:

=SUM(IF(FREQUENCY(IF($A$2:$A$6 >= D2, IF($A$2:$A$6 < D3,$B$2:$B$6)), $B$2:$B$6),1))<strike></strike>
 
Upvote 0

Forum statistics

Threads
1,216,117
Messages
6,128,937
Members
449,480
Latest member
yesitisasport

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top