Countif on dynamic rows in Access - excel

Hey I have a question for MS Access.
In Excel I would use the function =countif(A1:$A$2000; $B$3). So it only counts the ones in the same row and below.
How do I do that in MS Access? Something like count(iff([]))?
Cheers

Actually, there is an IIF function in ms-access. You can get the count if with a pipeline like:
SELECT Sum(IIf(id / 2 = id \ 2, 1, 0)) AS sum_of_even
FROM table;
In this case you obtain the sum of even ids. You can change the condition id / 2 = id \ 2 as you wish.

try this
counttotal: Count(IIf([credit]<20000,[credit],Null))
where credit is name of column, and you want to count the number of records where the value in the credit column is less than to 20,000

Related

How can I extract a total count or sum of agents who made their first sale in a specified month?

I am trying to extract some data out of a large table of data in Excel. The table consists of the month, the agent's name, and either a 1 if they made a sale or a 0 if they did not.
What I would like to do is plug in a Month value into one cell, then have it spit out a count of how many agents made their first sale that month.
Sample Data and Input Output area
I found success by creating a secondary table for processing a minif and matching to agent name, then countif in that table's data how many sales months matched the input month. However I would like to not have a secondary table and do this all in one go.
=IF(MINIFS(E2ERawData[Date Group],E2ERawData[Agent],'Processed Data'!B4,E2ERawData[E2E Participation],1)=0,"No Sales",MINIFS(E2ERawData[Date Group],E2ERawData[Agent],'Processed Data'!B4,E2ERawData[E2E Participation],1))
=COUNTIFS(ProcessedData[Month of First E2E Sale],H4)
Formula in column F is:
=MAX(0;COUNTIFS($A$2:$A$8;E3;$C$2:$C$8;1)-SUM(COUNTIFS($A$2:$A$8;"<"&E3;$C$2:$C$8;1;$B$2:$B$8;IF($A$2:$A$8=E3;$B$2:$B$8))))
This is how it works (we'll use 01/03/2022 as example)
COUNTIFS($A$2:$A$8;E3;$C$2:$C$8;1) This counts how many 1 there are for the proper month (in our example this part will return 2)
COUNTIFS($A$2:$A$8;"<"&E3;$C$2:$C$8;1;$B$2:$B$8;SI($A$2:$A$8=E3;$B$2:$B$8)) will count how many 1 you got in previous months of the same agents (in our example, it will return 1)
Result from step 2, because it's an array formula, we sum up using SUM() (in our example, this return 1)
We do result from step 1 minus result from step 3 (so we get 1)
Finally, everything is inside a MAX function to avoid negative results (February would return -1 because there were no sales at all and agent B did a sale on January, so it would return -1. To avoid this, we force Excel to show biggest value between 0 and our calculation)
NOTE: Because it's an array formula, depending on your Excel version maybe you must introduce pressing CTRL+ENTER+SHIFT
If one has got access to the newest functions:
=LET(X,UNIQUE(C3:C9),VSTACK({"Month","Total of First time sales"},HSTACK(X,BYROW(X,LAMBDA(a,SUM((C3:C9=a)*(MINIFS(C3:C9,D3:D9,D3:D9,E3:E9,1)=C3:C9)))))))

Count Values for Each Number in a cell in a Column

I have an excel sheet like the following, and would like to go down each row and add 1 to each of the numbers listed under the L3 column. Eventually, I would like to output something like this:
L3s Count Attr Ids
4770 10 [370, 380, ...]
6420 8 [481, 490...]
21253 20 [580....290]
... ... ...
The count is derived by going through all of the rows, and adding 1 to each L3 number whenever it is encountered. Attr IDs are the ids that contributed to the count. Is there any simple way to accomplish this in excel without having to vba/python?
Thanks in advance!
If you have windows Excel O365, you can use the following formulas:
(Note that I made the original data into a Table)
Sorted Unique list of the L3s:
=SORT(UNIQUE(FILTERXML("<t><s>" &SUBSTITUTE(SUBSTITUTE(TEXTJOIN("</s><s>",TRUE,Table1[L3s])," ",""),",","</s><s>")&"</s></t>","//s")))
Count of the L3s
=COUNT(FILTERXML("<t><s>" &SUBSTITUTE(SUBSTITUTE(TEXTJOIN("</s><s>",TRUE,Table1[L3s])," ",""),",","</s><s>")&"</s></t>","//s[.=" & F8 &"]"))
Associate Attr IDs
="[" &TEXTJOIN(",",TRUE,FILTER(Table1[attr],ISNUMBER(FIND(","&F8&",",SUBSTITUTE(","&Table1[L3s]& ","," ","")))))&"]"

EXCEL 2010 sum with multiple column criteria range in an OR logic

In Excel 2010, I have to table which have 5 columns and data shown in the picture
.
The rule is basically once someone’s name is in one of the three columns [Edit, Translation or Final Edit], I should add the Word count to them. But if the same name is in 2 of those columns, the word count should be added just once.
Is there a way to count how many words that each person have processed? Thanks.
Use SUMPRODUCT:
=SUMPRODUCT(--(($C$2:$C$13 = G7)+($D$2:$D$13 = G7)+($E$2:$E$13 = G7)>0),$B$2:$B$13)
Yes you can do it...Lets say you have a date like 2-Nov-2018 for entries...Change your output table and replace "Total Word COunt" by month name i.e. "Nov" and use below formula :
=SUMPRODUCT(--(($C$2:$C$13 = G9)+($D$2:$D$13 = G9)+($E$2:$E$13 = G9)+(TEXT((F4:F15),"MMM")=H8)>0),$B$2:$B$13)

Excel: Countifs on Multiple Columns and Only on Visible Rows (Filtering)

I've seen several forum posts with the answer to this question, but I can't really understand how it's supposed to work, so I figured I'd come here for an explanation.
I have three columns:
CITY........|.Attribute 1.|.Attribute 2.|
Chicago..|........1........|........1........|
Chicago..|........1........|..................|
Boston....|........1........|........1........|
Chicago..|..................|..................|
Boston....|..................|..................|
Boston....|..................|........1........|
Chicago..|........1........|........1........|
Chicago..|........1........|........1........|
I want to get a count of the number of times a city has a "1" in Attribute 1 and Attribute 2. Normally, you would use COUNTIFS (=COUNTIFS(B2:B9,"1",C2:C9,"1"))which would give you the value of 4 - Rows 2, 4, 8, and 9.
But I want to be able to filter this list on the fly, and only be able to see data for Chicago rows, for instance. And thus, want to see the value of 3 - Rows 2, 8, and 9. But when the data is filtered, I still get the value of 4.
What code do I need to insert into my cell to get the value of 3 after filtering my list to only show Chicago, if I want to see when a city has a "1" in both Attribute 1 and Attribute 2?
Thanks!
Would this not work for Chicago?:
=COUNTIFS(A2:A9, "Chicago", B2:B9,"1", C2:C9, "1")
This would not require you to filter the data.
A variant of this could be used:
SUMPRODUCT((Attribute 1.=Satisfactory)*(SUBTOTAL(103,OFFSET(AW3,ROW(tblStudentProgress[D3 Activity])-MIN(ROW(tblStudentProgress[D3 Activity])),0))))
You could also create a helper column and sum attributes 1 and 2. If your helper column row equals 2 then you know both attributes exist. You could take this one step further and use concatenate to combine "Chicago" and your sum. And then filter by Chicago2.

PivotTable - Calculate value depending on combination of row labels

WARNING - Using Excel 2011 for Macs, inexperienced user
Hi All,
I have a sheet in Excel with a bunch of categorical fields and some numerical ones as well. Let's say it looks like the following:
I would like to make a pivot table that will display the average click rate (avg_click_rate) of the unique combinations of [year, region], i.e. the combinations of fields in the pivottable's rows section.
For example, the avg_click_rate of [years=5] is:
(0.5*10)/(10 +5 ) + (0.6*5)/(10+5) = 0.53
while the avg_click_rate of [region=north] is:
(0.6*5)/(5+20) + (0.2*20)/(5+20) = 0.28
and the avg_click_rate of [years=5, region=south] is:
(0.5*10)/10 = 0.5
I know I have to make a custom Calculated Field to do this, but for the life of me I cannot figure out how to code the formula. Any help would be seriously, seriously appreciated.
To be clear, my formula would be:
SUM{ (click_rate * number_members) / SUM{number_members} }
where the numerator is a single value for each row included in the unique combination of [year, region], while the denominator is a constant - the total number_members for the unique combination of [year, region].
You should create a new column in your source table:
product = click_rate * number_members
And then create a Calculated Field in the pivot table:
CF = product / number_members
Using AVERAGEIFS:
AVERAGEIFS($C$2:$C$9,$A$2:$A$9,A2,$B$2:$B$9,B2)
EDIT:
You can add up to 127 conditions, see: AVERAGEIFS function
Criteria_range1, criteria_range2, … are 1 to 127 ranges in which
to evaluate the associated criteria.

Resources