My Formula is the following
=arrayformula(MIN(countif(F9:F,F9:F)))
but it does not skip blank cells. How do I get it to skip blank cells?
Filter the counted cells first.
=arrayformula(min(countif(filter(F9:F, not(isblank(f9:f))),F9:F)))
Speaking of which, min(countif()) seems redundant, countif should give you a single number so min() does not change anything.
Related
I'm usually pretty good about modifying the arrayformula so that cells aren't displaying values when there is no data adjacent to it. But, with these money values, I can't seem to change it to work. How can the arrayformula be changed so that $0.00 doesn't appear all the way down the column for data that is not yet present?
Here's the spreadsheet to edit. Arrayformula is in yellow highlighted cell.
Thanks for your help!
One solution is you can expand the computation to:
=ARRAYFORMULA(IFERROR(1/(1/(DMAX(TRANSPOSE(A3:G), SEQUENCE(ROWS(A3:G)), {IF(,,);IF(,,)}))),""))
The formula will originally return an error for zero result, but because of the IFERROR it will be replaced by space.
I've used this formula before but I don't really understand why it gives the result as such. I understand how anchors work ($A anchors the COLUMN and $2 anchors the ROW). However I'm still trying to understand if the cell is equal to a range, how come it displays the same number? In other words, the range B2:B6 all equal $A$2:$A
Why does this happen?
Does the cell evaluate the value of $A$2:$A(current row)? If so, shouldn't this yield a range rather than one specific number?
Thanks for the help
The main reason is because you are using a non-array function and therefore only single values will be passed. The same will happen if you use A2:A. Only one value (the first one corresponding to 10) will be displayed.
If you want to reference a range in a cell you should use an array formula to be able to populate all the cells of that range. You can easily achieve this by using ARRAYFORMULA as follows:
=ARRAYFORMULA($A$2:$A)
Is there a way to delete empty cells in a given range and shift the column up to the desired display as shown below? Closest I came was
=ARRAYFORMULA({A1:C1; TRANSPOSE(SPLIT(TRANSPOSE(QUERY(A2:C,,999^99)), " "))})
which removes empty cells, but splits the first names and surnames into separate cells, which I have not figured out how to avoid. Pfa a made-up sample of current and desired displays:
Current Display
Desired Display
I'm new at this, but I came up with a bit of a brute force method, which may help you.
={
{(A1:C1)};
{FILTER(A2:A100,A2:A100<>"");indirect("N1:N" & 100-counta(A2:A100))},
{FILTER(B2:B100,B2:B100<>"");indirect("N1:N" & 100-counta(B2:B100))},
{FILTER(C2:C100,C2:C100<>"");indirect("N1:N" & 100-counta(C2:C100))}}
Assuming your data block is in columns A1:C100, this formula filters blank cells from each individual column, and then pads each column with blank cells at the bottom, to make the three arrays equal in length/dimension.
Note that in "100-counta(...", the 100 is the expected maximum length of your data column.
This could be calculated, and must be the same for all three columns.
Note also that the first array is horizontal (ends with a semi-colon), followed by the three columns, stacked beside each other (ends with a comma).
Here is a working example.
https://docs.google.com/spreadsheets/d/1MGaqqGrkmIliuAzEqxPtdEVZXWPN2K5W7jFFM-ZnwgE/edit?usp=sharing
If I missed something you were trying to achieve, let me know.
Also, I'm sure that there is a more elegant way to do this, or one not requiring the use of a block of "reserved" blank cells, but I couldn't think of that at the moment.
Edit: The formula as follows also works. But you need to remember to set the "100" value to be equal to the number of rows in your data block, since we pad the columns with the necessary number of blanks rows, after removing the blank cells in each column.
={
{(A1:C1)};
{FILTER(A2:A,A2:A<>"");indirect("N1:N" & 100-counta(A2:A))},
{FILTER(B2:B,B2:B<>"");indirect("N1:N" & 100-counta(B2:B))},
{FILTER(C2:C,C2:C<>"");indirect("N1:N" & 100-counta(C2:C))}}
I am trying to use a sumifs statement to sum a column over 2 criteria. The column I am summing over has blank cells. The sumifs statement returns a zero for these instances, and I want it to return blank. Some of the sums are actually equal to zero so I need to differentiate between the zeros and the blanks.
You could try using if(isblank(cell), "", sumif())
if the one of the cells is blank, it returns a blank
else, it will use the sumif formula
I use Arrayformula() to make my reports dynamic and easier to edit. For example, if I have a Column A with a list o number o blue balls in a set and a Column B with a list red balls in a set, on the cell C1 I can write =ArrayFormula(add(A1:A,B1:B)) and in the Column C will have the total of balls in each set. It would be exactly the same as writing =A1+B1 in cell C1 and dragging the formula down to the last row. Arrayformula() has some benefits, because it will work if some adds or removes rows from the sheet and also it makes the reports way more organized and easier to edit.
Since I´ve discovered arrayformula(), my life has changed, because of the fact that googleSheets expands the formula to other cells. It does not work every time, but the idea of expanding to other cells seems to be possible some way or another, here is a good example of a problem that was not resolved by arrayformula(), but has the same idea.
Keeping that idea in mind, imagine that on Column A there is a list of First Names and on Column B there is a list of Last names. On Column C I want to join this two string using a simples space. The way to do that would be in the cell C1 write =join(" ",A1,B1) and then drag down this formula. This method method however is prone to error since people can add and remove rows, deleting my formula. I want to use a formula that I can write in one single cell and it expands to other cells. I´ve tried =arrayformula(join(" ",A1:A,B1:B)), but it does not work.
Is that a way to do that using =arrayformula() or other native function?
I know I could write a script or custom formula to do that, but this is not my goal here.
I think this formula should work:
=arrayformula(A1:A&" "&B1:B)
In case you want to use a delimiter, you can do the following to have a clean result even though, A or B is not present in some cases:
ARRAYFORMULA(ifna(ifs(isblank(A1:A),,ISBLANK(B1:B),A1:A),A1:A&" - "&B1:B))