How to only count unique record once and based on that count Yes or No - excel

I have 3 columns
ORDER, ID and E Yes/NO
In Column C order
In Column D ID
In Column E Yes/No
For example for ID = 144. I need count to how many order it was given to 144.
so looking at sample table below 144 was given 1 order which was 821 and column is Yes for 144 and when Order = 821.
Another example ID=162.
was given 2 order , 861 and 992. so his total order count is 2 and # of Yes count is 1 because row 13 is No.
I am really stuck on this complex logic.
Any feedback would be appreciated.

Given the layout shown, try these in B17 and C17 respectively, then fill down:
=SUM(IF(FREQUENCY(IF(MMULT(-(D$2:D$13=A17),1),C$2:C$13),C$2:C$13),1))
=SUM(IF(FREQUENCY(IF(MMULT((D$2:D$13=A17)*(E$2:E$13="YES"),1),C$2:C$13),C$2:C$13),1))

Related

Compare two columns and get the values from another column?

I have an excel table with multiple columns, I need to add value for every transaction_id, how can i compare column C with column J and enter values from K into D column?
Table looks like this:
C
D
J
K
transaction_id
amount
transaction_id
amount
1
5
1000
2
1
1000
5
118
200
118
117
500
I need to match the exact transaction_id and move from the right to left amount value if transaction id is the same, how can I do that?
Just use VLOOKUP:
Formula in D is:
=VLOOKUP(C2,$J$2:$K$5,2,FALSE)

How do I retrieve value in Column B Given 2 Criteria on the Same Row in an excel Formula

I have a table similar to the one below and am trying to get column B data based on the criteria in Column A and C. A = UserID, B = Description, C = Cost_Priority, D Cost. The table lists each userID, and common problem description, ranking the cost for the problem description and the cost of the problem description. This is a supplied table that I am working from.
UserID
Problem_Description
Cost_Priority
Cost
111
Problem A
1
395.00
111
Problem B
2
200.00
111
Problem C
0
150.00
111
Problem D
0
145.00
112
Problem G
1
800.73
112
Problem S
2
200.46
112
Problem T
0
100.51
Resulting Table should look like the one below where UserID is Given along with the columns
that define the Cost Priority Required. The problem I am having is getting the problem description
based on static values in the User ID columns static values of 1 for Highest cost problem and 2 for the 2nd highest cost problem.
UserID
Highest Cost Problem
2nd Highest Cost Problem
111
Problem A
Problem B
112
Problem G
Problem S
I have tried using a vlookup method to grab the USERID and compare Cost_Priority to 1 or 2 in an if statement but it was returning the Problem Description column in order including where Cost Priority was 0. I was wondering if someone else had any other ideas to populate the 2nd and 3rd columns in the 2nd table.
If you are on Microsoft 365 then try below formula. Drag down and across as needed.
=INDEX(SORT(FILTER($B$2:$C$8,($A$2:$A$8=$A12)*($C$2:$C$8>0)),2,1),COLUMN(A$1),1)
For older versions of excel try below array formula-
=INDEX($B$2:$B$8,MATCH(1,($A$2:$A$8=$A12)*($C$2:$C$8=COLUMN(A$1)),0))
Press CTRL+SHIFT+ENTER to evaluate the formula as it is an array formula.

Excel formula count after certain observation in c horological order

I am having tough time building a logic around this problem for a while , Hope some one can help.
I have 3 column of data. Lets call them Customer ID , Call ID , Agent ID
Customer ID and Agent ID can have repetition however Call ID is unique .
Now i have a table with these columns- they are stacked in chronological order based on date or time. Also one customer can call multiple time to multiple agent generating unique caller ID every time.
Here i want to count number of time one customer has called after certain agent ID has received the call. So count or freq function will have to have a rule embedded in chronological function or "Count after certain rule has been met"
Below is the table
CusID CalID Agent
1 123 a
1 22 b
1 112 a
1 222 a
1 54 a
1 334 a
2 221 a
2 312 b
2 334 b
2 129 b
2 986 a
4 98 b
In above table i want to calculate number of observation for customer id '1'after he has called to agent 'b' so the answer will be 4. I have used couple of unique count based no multiple crietria using combination of sumif 1/countif however major problem is counting after certain observation.
can any one help
You can use this formula that will change the range to count to match where b is found the first time.
=COUNTIF(INDEX(A:A,AGGREGATE(15,6,ROW($C$2:$C$13)/(($C$2:$C$13=E3)*($A$2:$A$13=E2)),1)+1):$A$13,E2)

In Excel how do subtract values from list table when I preform a transaction?

If I have two tables where I have list of things in 1 table and the other table serves as a transaction table. But every time I do a transaction the value of units in the transaction should be subtracted from the lists table. Can anyone please help?
Let's say table 1 looks like this:
A B C
1 Item Start Value Current Value
2 ---- ----------- -------------
3 1 20
4 2 100
5 3 95
and table 2 has transactions recorded as a list of Item numbers in column E and associated value movements in column F, then the formula in C3 should be:
=B3-SUMIF(E:E,A3,F:F)
This formula can then be copied down for the other entries in table 1

Spreadsheet - ordering a column twice, using different scores (from 2 other colums)

I am working on a spreadsheet - currently google docs but happy to see answers relating to other spreadsheet software.
I have a list of foods (column A - Food)
I have list1 of "scores" (column B - Score1)
I have list2 of "scores" (column C - Score2)
I would like to add two new columns, ideally ordering the food from column A according to the scores, both list1 and list2 - so one new column ordering the foods based on the score1 from column B, and the other new columns based on the score2 from column C.
An example usually helps, so here is what I have:
Food Score1 Score2
a 12 45
b 96 67
c 100 32
Now, this would be "Version 1", on the way to getting what I would like:
Food Score1 Score2 Order1 Order2
a 12 45 3 2
b 96 67 2 1
c 100 32 1 3
Or, even better, "Version 2" - use the food name in the new columns, in the right order according to scores:
Food Score1 Score2 FoodScore1 FoodScore2
a 12 45 c b
b 96 67 b a
c 100 32 a c
I suspect that getting "Version 1" is probably achievable (but don't know how to do it)
I suspect that getting "Version 2" is not possible without some sort of procedural programming?
Hope someone can help!
Cheers
Or, even better, "Version 2" - use the food name in the new columns, in the right order according to scores:
Let A2:A10 - is your food range, B2:B10 - score1 range, D2:D10 - destination range ( FoodScore1 in your example)
Works both in EXCEL and in GOOGLE-SPREADSHEETS:
=INDEX($A$2:$A$10,MATCH(LARGE($B$2:$B$10,1+ROW(A2)-ROW($A$2)),$B$2:$B$10,0))
enter this formula in D2 and drag it down
If formula will give you an error, try to change , to ; (depends on your local settings).
P.s. for score2 formula would be the same, just change ranges from score1 to score2 (i.e. $B$2:$B$10 to $C$2:$C$10)
I would start by adding a rank column, with number 1 for the highest score, number 2 for the second highest, etc.
In Microsoft Excel, assuming that the first column is A and that all the scores are unique, you could simply have a formula like
=COUNT.IF(B:B, ">=" & $B1)
in column D1, and similarly in column E for the second score.
Then if you fill column F with the ranks 1, 2, 3, ... you can simply do a VLOOKUP. Or, in this case, an equivalent solution with INDEX and MATCH - because you want to lookup the rank in column F and return the corresponding value from column A.
As you are working in a Google Spreadsheet, one would expect to see some Googliness in the solutions provided. Use this very simple, only usable in Google Spreadsheet, formula.
Formula
// FoodScore1
=QUERY(B2:D4, "SELECT B ORDER BY C DESC")
// FoodScore2
=QUERY(B2:D4, "SELECT B ORDER BY D DESC")
Screenshot
Explained
The data range of the QUERY function is simply B2:D4. Then a quasi SELECT statement is made to select only column B and ordered by column C or D, descendingly.
Reference
https://developers.google.com/chart/interactive/docs/querylanguage

Resources