I have a set of values, the Small function gives me the ability to get the top 5 smallest values. but it doesnt take into account duplicates. I want to only see each value once. for example:
1 2 2 3 4 5
i want to output 1,2,3,4,5 not 1,2,2,3,4
I am putting the output into 5 different columns with the formula Small(A1:A20,[1-5])
but im not sure how to tell it to only look at each distinct value in the range
If one has access to the dynamic array formulas (currently only available to office 365 insiders) one can just put this in the first cell and the results will spill across:
=SMALL(UNIQUE(A:A),SEQUENCE(,5))
Other wise we need to use some array formula in a specific manner.
We must have something besides a number in the cell directly preceding where we put the formula in the first cell. So if I am putting the formula in C1, B1 must not contain one of the numbers as we need to refer to it.
Put this in C1:
=SMALL(IF(COUNTIF($B$1:B$1,$A$1:$A$20)=0,$A$1:$A$20),1)
Being an array formula it must be confirmed with Ctrl-Shift-enter instead of Enter when exiting edit mode. Then copy over 5 columns.
If one cannot leave the cell B1 without a number then we must get the array another way:
Put this array formula in the first cell:
=SMALL(INDEX($A:$A,N(IF({1},MODE.MULT(IF(MATCH($A$1:$A$20,$A:$A,0)=ROW($A$1:$A$20),ROW($A$1:$A$20)*{1,1}))))),COLUMN(A:A))
Being an array formula it must be confirmed with Ctrl-Shift-enter instead of Enter when exiting edit mode. Then copy over 5 columns.
Here is another option and in single formula
Assume your data 1 2 2 3 4 5 put in A1:A6
B1, left blank
In C1, formula copied cross right until blank
=IFERROR(1/(1/AGGREGATE(15,6,$A$1:$A$20/($A$1:$A$20>B1),1)),"")
Edit : AGGREGATE is a function for Excel 2010 or above
Here is another option:
Formula in C1:
=SMALL($A:$A,COUNTIF($A:$A,"<="&B1)+1)
Drag right...
Related
I am creating a form that autopopulates data when another form is pasted onto the workbook. I combined numbers from 5 different cells into one cell using this formula
=TEXT(L2,IF(L2=0," ","$000,000"))&"; "&TEXT(L3,IF(L3=0," ","$000,000"))&"; "&TEXT(L4,IF(L4=0," ","$000,000"))&"; "&TEXT(L5,IF(L5=0," ","$000,000"))&"; "&TEXT(L6,IF(L6=0," ","$000,000")).
Sometimes I will need to hide 3 rows, meaning I only need 2 of the numbers combined. The problem is that it still captures the 5 numbers. Is there a way to combine the visible cells only?
If you want to skip the blank cells use TEXTJOIN():
=TEXTJOIN("; ",TRUE,if(l2:l6<>"",TEXT(L2:L6,"$000,000"),""))
Use as an array formula, confirm with Ctrl-Shift-Enter instead of Enter when exiting edit mode.
I'm going crazy over this, trying to figure out how to make a dynamic array to create a smaller list from a bigger list based on a criteria. All of it needs to be dynamic because the base list will change. Have googled for two days but can't find the proper solution.
I'm a rookie creating these things. Have tried below but it doesn't work:
=IFERROR(INDEX('2.Data'!$L$3:$L$300;SMALL(IF('2.Data'!$L$3:$L$300="12378";ROW('2.Data'!$L$3:$L$300)-ROW('2.Data'!$L$3)+1);ROWS(B$2:B2)));"")
Example:
Column A
1. 12345
2. 12345
3. 12378
4. 12345
5. 12378
6. 12345
Column B (result)
1. 12378
2. 12378
Column B should have a fancy formula that gets value from column A based on criteria=ends with 78, presented without empty cells between values.
With data in column A, in B1 enter the array formula:
=IFERROR(INDEX($A$1:$A$26,SMALL(IF(RIGHT($A$1:$A$26,2)="78",ROW($A$1:$A$26)),ROW(1:1))),"")
(your version of Excel may require the ; rather than the , in the formula) and copy downward:
Array formulas must be entered with Ctrl + Shift + Enter rather than just the Enter key. If this is done correctly, the formula will appear with curly braces around it in the Formula Bar.
You can avoid the array formulas if you use a "helper" column.
so this is what I'm trying to do:
You can see B1 formula in B2 and C1 formula in C2.
I'm applying the formulas with ctrl+shift+enter, thats why there is "{ }" around the formulas.
The correct value is from C1, as it can be seen if you place this on Google:
10^0.5 + 10^0.6 + 10^0.7
I have no idea why this is happening!
Thanks for the help.
When you do the whole column it is including all the blanks as 0
10^(0/10) = 1
So it is adding 1 for each row that is blank, that is 1048573 rows or 1048573+12.1552217
One should not use full column references when using array formulas.
You can limit the range with this array formula and still be dynamic
=SUM(10^($A$1:INDEX(A:A,MATCH(1E+99,A:A))/10))
Being an array formula it needs to be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode.
Now you can add to the list without changing the formula and only iterate through the data without extra iterations.
You can remove the need for Ctrl-Shift-Enter with SUMPRODUCT():
=SUMPRODUCT(10^($A$1:INDEX(A:A,MATCH(1E+99,A:A))/10))
It still has the need to limit the data range to only the data to limit the iterations, but can be entered normally.
If you really want to do the extra iterations you will need to put an IF in you SUM:
=SUM(IF(A:A<>"",10^(A:A/10)))
or with SUMPRODUCT:
=SUMPRODUCT((A:A<>"")*(10^(A:A/10)))
These will be slower as they are doing nearly 2 million calculations, 99.9% of which are unneeded.
I dont know if i asked my question correctly but
This is what i want to do
By filling the numbers in the yellow cells i want to display the numbers in green, the numbers in green are just a simple division of Quantity/Duration and the y start displaying at the column of "Start"
I know it can be easily done with visual basic, but i want to know if there is a way to do it without it.
So three formulas, one array formula and two regular formulas:
column A:
=SUM(D2:K2)
Column B will refer to column C:
=MATCH(1E+99,D2:K2)-C2+1
Column C is an array formula:
=MATCH(TRUE,(D2:K2<>0),0)
Being an array formula it must be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode. If done correctly then Excel will put {} around the formula.
Once the three formulas are in the first row. Copy/Drag them down.
I have put a condition for few cells in an excel as Pass and Fail.
Say there are 10 cells where one can select Pass/Fail. Now i need to calculate number of Pass and Number of Fail selected and the count needs to be displayed in another sheet.
Eg: In the 10 cells, User would have selected 7 Pass and 3 Fail. I need to display this count in another tab as 7 and 3.
Can someone help me with the formula to do this?
It's easy:
=COUNTIF(A1:A10,"Pass")
=COUNTIF(A1:A10,"Fail")
Another option for doing this is to use an array formula.
Something like this:
{=SUM(IF(A1:A10="Pass",1,0))}
Or in R1C1 mode:
{=SUM(IF(R1C1:R10C1="Pass",1,0))}
It is very important to enter these formulas holding down the CNTL+SHFT keys together when hitting ENTER. That's what makes an array formula work.
The advantage with this type of formula is you can make it quite a lot more complex than a simple COUNTIF.
If you want to display it in single cell in different sheet you can use this formula using the concatenate method(&)
'=COUNTIF(Sheet1!A1:A10,"Pass")&" Pass "& COUNTIF(Sheet1!A1:A10,"Fail")&" Fail"
Will result to:
7 Pass 3 Fail
Just change the name of the Sheet or the location of the data, sampled is located in A1 to A10 and on Sheet1
If you want it in different cells,
=COUNTIF(Sheet1!A1:A10,"Pass")
=COUNTIF(Sheet1!A1:A10,"Fail")
Will result to:
7
3
Hope that helps.
The simplest method is to use the COUNTIF function like so:
=COUNTIF(Sheet1!A1:A10,"Pass")
=COUNTIF(Sheet1!A1:A10,"Fail")
This assumes the sheet containing the data is called Sheet1