I'm trying to make a formula that lets me easily extrapolate a quality within a subser
Let's say I have the following set of data:
Week Name Accepted? Accept Week?
1 a TRUE
1 b TRUE
1 c TRUE
2 d FALSE
2 e TRUE
2 f TRUE
3 g FALSE
3 h FALSE
3 i FALSE
Three weeks, three entries each
I'm trying to make a formula that fills Column 4:
Week 1 would be TRUE because all three entries (B2:B4) are accepted week TRUE
Week 2 has a non accepted entry, therefore all three entries (B5:B7) are FALSE
Week 3 is false as well in Accept Week (B8:B10)
I would appreciate any tip you can give to me.
Use this formula:
=COUNTIFS(A:A,A2,C:C,TRUE) = COUNTIF(A:A,A2)
Related
There are 3 columns:
Date, Name, Bonus_Point?
If a player scores a 4 or lower in the Name Column for three consecutive Dates, then Bonus_Point will return a 'Yes' or 'No'
For example, for 1/30/22, there would be a 'Yes' because there were 3 previous instances (including 1/30/22) where the score is less than or equal to 4.
But for 2/2/22, Bonus_Point? would be 'No' because on the third day, Name scored a 5.
Assuming your columns are A through C, and the row 1 is the header row and your data is in rows 2 and down, enter this formula in C4:
=AND(B2<=4,B3<=4,B4<=4)
Then fill down. (See further down for "yes" and "no")
Date
Name
Bonus_Point?
1/28/22
3
1/29/22
3
1/30/22
3
TRUE
1/31/22
3
TRUE
2/1/22
4
TRUE
2/2/22
5
FALSE
2/3/22
2
FALSE
2/4/22
5
FALSE
2/5/22
4
FALSE
2/6/22
3
FALSE
2/7/22
2
TRUE
2/8/22
3
TRUE
2/9/22
4
TRUE
2/10/22
3
TRUE
2/11/22
2
TRUE
2/12/22
2
TRUE
3/13/22
3
TRUE
If you want "Yes" and "No", you can do that through formatting or add it to the formula:
=IF(AND(B2<=4,B3<=4,B4<=4),"Yes","No")
I see the following formula in a Excel spread sheet and can not understand... Can anyone explain what the test condition "N5=N4:N741" mean?
=MIN(IF(N5=N4:N741,K4:K741))
I made some experiments and still cannot get a clue...
I'm assuming this is an array formula.
What this does is takes the minimum of the range K4:K741 where the value in N4:N741 equals the value in N5.
Let's look at a smaller example. K4:N9 is shown below.
K L M N
----------
4 | 4 2
5 | 8 7
6 | 3 4
7 | 2 1
8 | 7 9
9 | 1 7
The expression N5=N4:N9 is true in row 5 and row 9 since both of those match N5 (value = 7), giving the array {False,True,False,False,False,True} Thus IF(N5=N4:N9,K4:K9) will return {False,8,False,False,False,1} since the True values are replaced by the corresponding row in column K. The MIN() function will then ignore the False parts and return the minimum of the corresponding values in column K (the value 1 since 1 < 8).
I believe it returns an array of true and false values. I also believe the true shows up for the 3 because it is the third item in the array. but that is a guess on my part.
{false, false, true, false,false}
If you change your 5 in E1 to a 1, it will return a true.
Research all of many things excel
I would like to learn how to make Excel formulae understand my subsets. An Example:
Week Value Number Accept? First
1 a 11 TRUE a
1 b 12 TRUE FALSE
1 c 13 FALSE FALSE
2 d 13 FALSE f
2 e 12 FALSE FALSE
2 f 12 TRUE FALSE
3 g 12 FALSE #N/A
3 h 13 FALSE FALSE
3 i 13 FALSE FALSE
4 j 14 FALSE k
4 k 14 TRUE FALSE
4 l 12 TRUE FALSE
Column A (Week) defines subsets, separated for clarity.
"First" uses the formula
=IF(A1<>A2,INDEX($B$1:$B$100,MATCH(A2&TRUE,$A$1:$A$100&$C$1:$C$100,0))
Which allows me to select the first value which satisfies condition Accept?, within subsets (It seems rather inefficient, so if anyone has a better idea I'd gladly test it)
Now imagine the following data:
Value Time Price Trigger?
x 14 500
a 11 490
b 12 480
c 13 320
d 14 560
e 15 570 e
f 16 490
g 17 520 g
X is a comparison value. It has 2 parameters: Time & Price
"Trigger" searches for values in the list that have greater time and price than X (Row 2)
The formula for Trigger would be something like:
=IF(AND(B3>$B$2;C3>$C$2);B1;"")
But, how do I make this same thing work, within weeks ("subsets")?
=IF(IFERROR(INDEX(INDEX(A:A,MATCH(A2,A:A,0)):INDEX(D:D,COUNTIF(A:A,"<="&A2)+1),MATCH(TRUE,INDEX(D:D,MATCH(A2,A:A,0)):INDEX(D:D,COUNTIF(A:A,"<="&A2)+1),0),2)=B2,FALSE),B2,FALSE)
Here is the explanations:
INDEX(A:A,MATCH(A2,A:A,0)):INDEX(D:D,COUNTIF(A:A,"<="&A2)+1): This is to determine the range/subset that corresponds to the Week, so you will get $A$2:$D$4, $A$5:$D$7, $A$8:$D$10, $A$11:$D$13 as outcome.
MATCH(TRUE,INDEX(D:D,MATCH(A2,A:A,0)):INDEX(D:D,COUNTIF(A:A,"<="&A2)+1),0): You probably know this already. This is to satisfy the condition on Accept column. But I have to add another range by using INDEX again just for column Accept.
Then I used an IF function to determine if the result is equal to Value column, otherwise will output FALSE. You don't need this if you don't mind the same outcome for every cell on First column.
Lastly, I personally don't like those error code so used IFERROR to output the error message I prefer. You can remove that for your preference.
Hope this helps.
I'm struggling to understand the mechanics of a particular array formula. I have a row of data ranging from January 2015 to December 2016. Let's assume the data is populated up to October 2016 and the sum in October is £1,000. When data is entered into November 2016 say £1,250, the formula below automatically calculates the delta between the two months. How did the formula do that. Could someone help provide a simple explanation of the below, in particular how it knew to deduct the latest month from the prior month.
=(INDEX(60:60,MAX(IF(M60:AV60<>"",COLUMN(M60:AV60)))))-(INDEX(60:60,MAX(IF(M60:AV60<>"",COLUMN(M60:AV60)-1))))
Thanks for your help,
Miles
It's a little complex, but let's break it down a piece at a time.
This looks to be an array formula, which means that rather than dealing with a single cell, it can deal with a whole set of cells at once.
M60:AV60<>"" This segment produces an array (list) of TRUE and FALSE values, looking at each cell between M60 and AV60. Wherever the cell contains a value - ie is not blank - it returns TRUE. Wherever the cell does not contain a value, it returns FALSE. This list exists only in the program's working memory, and it isn't recorded anywhere in the sheet. So we have something like this:
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
FALSE
FALSE
FALSE
FALSE
FALSE
COLUMN(M60:AV60) This segment produces another array, the same size as the TRUE/FALSE array above, that simply contains the column numbers of every cell from M60 to AV60. We now have two lists - one containing TRUE/FALSE, and one containing numbers, both the same length.
TRUE | 1
TRUE | 2
TRUE | 3
TRUE | 4
TRUE | 5
TRUE | 6
FALSE | 7
FALSE | 8
FALSE | 9
FALSE | 10
FALSE | 11
IF(M60:AV60<>"",COLUMN(M60:AV60)) This IF statement combines the TRUE/FALSE array with the column numbers array to get something more useful. Wherever there is a TRUE in the first array, it is replaced with the corresponding number from the second array; wherever there is a FALSE in the first array, nothing is changed, and the value stays at FALSE. This way, we end up with a list of numbers, representing the columns of each non-blank cell. It's the equivalent of running the IF formula on all the members of the array.
IF | TRUE |THEN| 1 = 1
IF | TRUE |THEN| 2 = 2
IF | TRUE |THEN| 3 = 3
IF | TRUE |THEN| 4 = 4
IF | TRUE |THEN| 5 = 5
IF | TRUE |THEN| 6 = 6
IF | FALSE |THEN| 7 = 0
IF | FALSE |THEN| 8 = 0
IF | FALSE |THEN| 9 = 0
IF | FALSE |THEN| 10 = 0
IF | FALSE |THEN| 11 = 0
The last column, after the =, is what is passed to the MAX function.
MAX(IF(M60:AV60<>"",COLUMN(M60:AV60))) This segment cuts down the list of numbers to just one number, the Max or highest number in the list. Thus we end up with a single result, which represents the last column that contains a value.
INDEX(60:60,MAX(IF(M60:AV60<>"",COLUMN(M60:AV60))))) The INDEX function looks at all of row 60, and returns a value from a specified column in that row. That being the column returned by the previous segments - the last column that contains a value.
The second half of the formula with the second INDEX function does exactly the same thing, but it subtracts 1 from the column number returned - that is, it gets the second-to-last column that has a value.
The end result is subtracting the second-to-last value from the last value, to get the difference between them.
I have a source sheet set up like this:
Days Open Month
10 1
4 1
6 1
2 1
4 2
2 2
-1 2
4 3
6 3
7 4
3 4
etc
I'm trying to set up a formula to count rows based on the following criteria:
cells in Days Open column <=5 and <>-1 where the month is either 2, 3, or 4 (the worksheet will eventually have month numbers up to 12, and I need to group results quarterly). The total must then be divided by the total of ALL rows in which 2, 3, or 4 appears in the Month column.
I can't seem to get the first part of the COUNTIFS to work with both criteria... this is what I have so far that I'm trying to make work:
=COUNTIFS('Cumulative Complaints'!K:K,"<=5",'Cumulative Complaints'!K:K,"<>-1")/(COUNTIF('Cumulative Complaints'!L:L,"2")+COUNTIF('Cumulative Complaints'!L:L,"3")+COUNTIF('Cumulative Complaints'!L:L,"4"))
I've been looking around here and other excel forums and think maybe SUMPRODUCT is the way to go? I haven't been able to get that to work though, given the criteria needed on the Days Open column (<=5 and <>-1).
Try this SUMPRODUCT() FORMULA:
=SUMPRODUCT(('Cumulative Complaints'!K:K<=5)*('Cumulative Complaints'!K:K<>-1)*('Cumulative Complaints'!L:L>=2)*('Cumulative Complaints'!L:L<=4))/SUMPRODUCT(('Cumulative Complaints'!L:L>=2)*('Cumulative Complaints'!L:L<=4))
When using the SUMPRODUCT the condition AND is replaced with the *. It requires all four conditions to be True to return a 1; 1*1*1*1 = 1 if any are false they return 0 so 1*1*0*1 = 0. So as it iterates through the rows it returns a 1 or a 0 to the be added to the sum.
Wrapping a COUNTIF or COUNTIFS function in a SUM function allows you to use an array of constants as OR citeria.
=SUM(COUNTIFS('Cumulative Complaints'!K:K, "<>"&-1,'Cumulative Complaints'!K:K, "<="&5,'Cumulative Complaints'!L:L, {2,3,4}))/SUM(COUNTIF('Cumulative Complaints'!L:L, {2,3,4}))
This is not an array formula and does not require CSE.
My answer would be to take a different approach.
Excel has a very powerful feature called Pivot Tables, and I think it might be a good fit for your problem and other similar problems you may face.
First, I would add a couple columns to your table, like so:
Days Open Month Quarter RecentlyOpened
10 1 1 FALSE
4 1 1 TRUE
6 1 1 FALSE
2 1 1 TRUE
4 2 1 TRUE
2 2 1 TRUE
-1 2 1 FALSE
4 3 1 TRUE
6 3 1 FALSE
7 4 2 FALSE
3 4 2 TRUE
The formula for Quarter is: =CEILING(B2/3,1)
The formula for RecentlyOpened is: =AND(A2<>-1,A2<=5)
Second, select the table, and do Insert > Pivot Table.
Third, drag from the fields to the boxes, like so:
Drag Quarter to the ROWS box
Drag RecentlyOpened to the FILTERS box
Drag Month to the VALUES box
Fourth, click Sum of Month, and select Value Field Settings to change Sum to Count.
Fifth, set the RecentlyOpened filter to TRUE.
The result is this:
Pivot Tables often provide a solution that is more flexible and easier to read and understand versus complex formulas.