How to skip counting same value set in 2 columns that appears in another 2 columns set - excel

Good day, I need some help on how to form an Excel formula to count distinct for values in 2 columns with other columns:
I want to count a number of subjects assigned to "ummu", but that same subject name appears again shouldn't be count. In this example, the count will return 4. How can I achieve this using excel formula?

Related

Single formula with Multiple Countifs and where data table contains duplicate values in more than one column

The excel file contains a structure table. (which I find difficult to work with but I can't alter the file structure, I am just adding a summary tab with various counts from the data table.)
Item
Month
1
2
2
2
2
2
2
3
3
3
3
4
The item number itself can repeat and be repeated within the same month.
I was able to get a count of total number of unique items using this formula.
=SUMPRODUCT((Item_tab[Item]<>"")/COUNTIF(Item_tab[Item],Item_tab[Item]&""))
Looking for how to count the number of unique items within a specific month.?
Example of Desired output.
Edit/Set formula for Month 2 , output should be 2
Edit/Set formula for Month 3 , output should be 2
Edit/Set formula for Month 4 , output should be 1
I cannot figure out how to apply countifs to something that needs to avoid duplicates in multiple columns.
Tried this but returns #VALUE!
=SUMPRODUCT((Item_tab[Item]<>"")/COUNTIFS(Item_tab[Item],Item_tab[Item]&"",'Item'!M:M,6))
The month column was added later and I don't know how why or how to get that column to have the structured table column Header like everything else.
The sheet name is Item
The Table Name is Item_tab
I can find where to rename the table but not the columns. Not sure the variance is causing an issue. The month column is absolutely part of the table in every way that I can see.
You can try the following in cell D2:
=LET(A, A2:A7, B, B2:B7, uxB, UNIQUE(B), cnts, BYROW(uxB, LAMBDA(u,
ROWS(UNIQUE(FILTER(A, B=u))))), HSTACK(uxB, cnts))
Here is the output:
If you want to get the result repeated instead of consolidating the result by unique months, you can try the following:
=LET(A, A2:A7, B, B2:B7, uxB, UNIQUE(B), BYROW(B, LAMBDA(u,
ROWS(UNIQUE(FILTER(A, B=u))))))
If you don't have such function available, you can try the following formula in D2, it produces the same result as the first formula:
=CHOOSE({1,2}, UNIQUE(B2:B7),
MMULT(N(MMULT(TRANSPOSE(N(B2:B7=TRANSPOSE(UNIQUE(B2:B7)))),
N(A2:A7=TRANSPOSE(UNIQUE(A2:A7))))>0), SEQUENCE(ROWS(UNIQUE(A2:A7)),,1,0)))
or using LET for a better reading and maintenance:
=LET(A, A2:A7, B, B2:B7, CHOOSE({1,2}, UNIQUE(B),
MMULT(N(MMULT(TRANSPOSE(N(B=TRANSPOSE(UNIQUE(B)))),
N(A=TRANSPOSE(UNIQUE(A))))>0), SEQUENCE(ROWS(UNIQUE(A)),,1,0))))

How to get distinct count in excel from two columns

Let's say I have two columns as below:
Now if I want to get distinct count based on my multiple criteria, I tried to apply the formula below
=SUM(COUNTIFS(A2:A7,"Arnold",B2:B7,"1"))
Now the result is 2 because Arnold matches twice with Column B with value 1.
Now I need the output to be 1 based on distinct value in column B.
USE
=SUMPRODUCT((B2:B7=1)/(COUNTIFS(A2:A7,A2:A7,B2:B7,1)+(B2:B7<>1)))

Sum of specific number of rows for a id in excel

I am pretty new to excel formulas. I want to calculate the sum of prices for every unique id. Using SUMIF I was able to do that for every unique id but I only want to calculate the sum of a number of rows for that id.
=SumIF(A:A;C2;B:B)
Sample data is attached. Actual data set is quite large. For Example, For Id 1, I only want to calculate the sum of first 3 rows (Column price) corressponding to that id, for id 2 the sum of first 4 rows and so on.
Sample data:
This formula works for sorted and non sorted data:
=SUMIF($A$2:INDEX(A:A,AGGREGATE(15,6,ROW($A$2:$A$20)/($A$2:$A$20=C2),D2)),C2,$B$2:INDEX(B:B,AGGREGATE(15,6,ROW($A$2:$A$20)/($A$2:$A$20=C2),D2)))
Enter this as an array formula (ctrl+shift+enter):
=IFERROR(SUMPRODUCT(IF(ROW($A$2:$A$20)>SMALL(IF($A$2:$A$20=C2,ROW($A$2:$A$20),FALSE),MIN(D2,COUNTIF($A$2:$A$20,C2))),0,1),IF($A$2:$A$20=C2,1,0),$B$2:$B$20),0)

Retrieve multiple results in a data table

I have set up this Excel page with approximately 40 rows and 8 columns to compare the financial benefits of 2 different products based on age.
Once I input an age at the top, the next row will have that age +1 for approximately 40 rows, and then the columns beside it will value my products at the new age in every column.
I want certain information from my 5th column, based on the age that is being inputted (I figured out this part). I have a list of ages that I need to use as inputs and want the information from column 5 for each one of those input ages at the same time. I tried using a data table.
To grab the information from column 5 I use this formula: =INDEX($B$9:$F$49,MATCH(E$55,$B$9:$B$49,),5)
if i understand, the age is in column B, and the needed info in column F ?
Also E55 is the searched Age ?
Then you where near :
try
= INDEX($B$9:$B$49,MATCH(E$55,$B$9:$B$49,),5)

Finding matching value in sheet 2 and copy adjacent cells value in sheet 1

I have searched through many similar topics but could find nothing that will do what I need.
I am trying to create a worksheet that will track scores for a darts game.
On Sheet 1 I have two columns that simply tracks each players throws from 501 down to 0
Row 25 is the amount remaining for each player.
In Sheet 2 I have 2 columns. The Column A contains scores that you can check out on, and Column B contains the checkout e.g. (T20, T20, D18). So if the value in row 25 of Sheet 1 matches any of the values in Column A of sheet 2, the I want to display the Value of Column B in the matching row on Sheet 2 Underneath the remaining score on Sheet 1.
Can anyone point me in the right direction?
not sure what you mean exactly, but this formula in row 26 should do the trick:
=index('Sheet 2'!$B:$B;match(A25;'Sheet 2'!$A:$A;0))
if your list separator is comma ,, use that instead of semicolon ;
you might want to use 1 as the third argument of match function, if you want to display the checkout according to the nearest match that is bigger than the number in row 25 and the column A in Sheet 2 is sorted in ascending order (1-9)
or -1 if you want the nearest match that is smaller and column A is sorted in descending order (9-1)
You can use this:
=IFERROR(VLOOKUP(A4, Sheet2!$C$2:$E$65535, 3, FALSE),0)

Resources