count the unique cell values based on multiple conditio - excel

I was able to count all the values using countifs, but I would like to count only the unique values in the cell.
Condition: If A value matches with K column values and L column values are completed or In progress, then count unique values in column I
EX: K2, K3, K4 matches the code ABP in A2, then it should return the count as 2
count abc#xyz.com as 1 if the status in any cells in L is completed or In progress.
Do not count mnp#xyz.com and gh#xyzcom because the status is enrolled
Does anyone have any idea?

Related

Count # unique values of column if all values in corresponding values are identical

I'm looking to have E2 and E3 count the number of unique entries in column B based upon met criteria in column A.
Complete (E2) would count all of unique entry Address1 in column B only if any status of Address1 is set to Cancelled or Installed. Pending (E3) would count all of unique entry Address2 and unique entry Address 3 only if all corresponding status' are Pending.
With Office 365 we can use nested Filters and Match to return the list of items that meet the necessary criteria those with and without anything but Pending. Then we use UNIQUE to make the list unique and COUNTA to count the number of returns:
For Completed:
=LET(itm,B2:B10,sts,A2:A10,unq,(UNIQUE(FILTER(itm,ISNUMBER(MATCH(itm,FILTER(itm,sts<>"Pending"),0))))),IF(ISERROR(#unq),0,COUNTA(unq)))
For Pending:
=LET(itm,B2:B10,sts,A2:A10,unq,(UNIQUE(FILTER(itm,ISERROR(MATCH(itm,FILTER(itm,sts<>"Pending"),0))))),IF(ISERROR(#unq),0,COUNTA(unq)))
Formula I used in E2
=SUM(--(UNIQUE(FILTER($B$2:$B$10,($A$2:$A$10="Cancelled")+($A$2:$A$10="Installed")))<>""))
In E3 formula is
=SUM(--(UNIQUE(FILTER($B$2:$B$10,($A$2:$A$10="Pending")))<>""))

Find the string subtract matching values

I want to calculate J column cells automatically based on A , C and I cells, as shown in screenshot for contract ID 111 total value is 800 and in C column there are total 600 values against 111 contract ID, I want to to auto calculate the remaining amount in J cells against each contract.
Use SUMIFS and simple subtraction.
=I2-SUMIFS(C:C,A:A,H2)

COUNTIF Unique values

I used this formula to find SKU counts in certain categories given multiple criteria:
=+COUNTIFS(Data!$AG:$AG, ">"&0,Data!$AO:$AO, "="&$A115,Data!$L:$L, "="&D$104,Data!$P:$P,$B$103)
I am able to find the SKU counts but it gives me the total SKU count, I believe because it now counts any SKU with inventory greater than 0 with my multiple criteria.
How can I change the formula to get the unique SKU count per division?
Column AG: Inventory
Column AO: Division Name
Column L: Month
Column P: Year
Column T: SKU Code(written out) - what I need to find unique values of.
Example here: dropbox.com/s/hxbt7hb9l8hf4w6/Sample%20Example.xlsx?dl=0
If you created a helper column on the input sheet with the formula (e.g. in BG2):
=1/COUNTIFS(T:T,T2,AG:AG,">0",AO:AO,AO2,L:L,L2,P:P,P2)
This means that if you had, for example, 5 times the SKU in one Division/Month/Year, you would get 1/5. Then, in the calculation sheet, replace your COUNTIFS with a SUMIFS (summing your new helper column, using same conditions). This will mean that your 5 duplicates (with 1/5 in the helper) get summed to 1 - i.e. 1 unique SKU
EDIT
Because there are some where there is no positive inventory, the count gives you 0 and you get a #DIV/0! error... so we can fix that with:
=IFERROR(1/COUNTIFS(T:T,T2,AG:AG,">0",AO:AO,AO2,L:L,L2,P:P,P2),0)
Then, in the Output-EOM Unique SKU Count sheet, in cell e.g. B6, use:
=SUMIFS(input!$BG:$BG,input!$AO:$AO,$A6,input!$L:$L,B$5,input!$P:$P,$B$4)

Excel, Get count if two cells have specifice value

i have an excel sheet with some test result(PPV Predictive Positive Value) like below, i want to find out the count if
Test1=1 Test2=1 count is 2
Test1=1 Test2=0 count is 1
Test1=0 Test2=1 count is 1
Test1=0 Test2=0 count is 1
Let's assume your table starts in A1 cell. Write this in C2 cell:
=MAX(A2+B2,1)
Or if you are a Boolean maniac:
=AND(A2;B2)+1
Then count the sum at the bottom of the column.
If Test1 is in col A and Test2 is in col B, you could use a countifs formula like =countifs(A:A,1,B:B,1) for your first condition. Then, =countifs(A:A,1,B:B,0), =countifs(A:A,0,B:B,1), and =countifs(A:A,0,B:B,0) for your others.
The formula works by looking in col A for the condition you specify(1 or 0) and doing the same for col B, then only counting the ones that meet both criteria.

Identify matching numbers and then imput a value from a different column

I have two sheets, Sheet1 and Sheet2. Sheet1 has a list of company names in column A, Revenue in column B and a unique number identifier in column D (also seen as "unique #forAAA in Sheet2). In Sheet2, I pulled a list from Hoovers, and the format comes up something like below (so this format should not be changed).
Column A B C D
Company Name Place Type of Comp Revenue
1 AAA US HQ 10.0 M
2 unique #forAAA
3 BBB India Branch 5.0 M
4 unique #forBBB
What I'd like to do is match the unique number for each company between Sheet1 and Sheet2 and then put the revenue # from Sheet2 into column B of Sheet1 which corresponds to the correct #. I'm pretty lost here, so any help or ideas would be great. Thanks for your help!
Because the unique identifier is on a different row than the result to be returned, you can use a variation using INDEX and MATCH:
=INDEX(Sheet2!D:D, MATCH(D2, Sheet2!A:A, 0)-1)
INDEX will return the value within range Sheet2!D:D on row MATCH(D2, Sheet2!A:A, 0)-1.
MATCH(D2, Sheet2!A:A, 0) will give you the row number where the unique ID is found, then -1 to get the row number of the revenue amount.
EDIT: As per comment, to remove the M, you can use this:
=TRIM(SUBSTITUTE(INDEX(Sheet2!D:D, MATCH(D2, Sheet2!A:A, 0)-1),"M",""))
I would put the unique value in a column inserted before A (would be the new column A) instead of putting it below each row. Then, in the other sheet I'd put the VLOOKUP like this:
=VLOOKUP(D2,Sheet2!A:E,5,0)
That should return the value in column E (column D before the column insertion, i.e. revenue for the unique company identifier).
Note that the third argument in the vlookup function is the number of the column you want to be retrieved, so the range defined in the second argument (Sheet2!A:E) should contain that column.

Resources