Ignore cells that aren't numbers without using IsNumber - google-sheets

The formula in cell F3 is this
=SUMPRODUCT($A$4:$A$2000, F4:F2000,--($A$4:$A$2000>=0*F4:F2000>=0))
It multiplies Col A with Col F (and then col G, H, etc) and gives the result in row 3.
Some cells contain 'N/A' or 'tr'. I hoped that last >=0 condition would somehow just ignore them but alas. I'm hoping there is a simple of way of saying: ignore everything that isn't a number. I tried if(isnumber) but I was putting it everywhere because I didn't know exactly where it should go in this case, and all those if then conditions were getting so long!
Is there a simpler way? Or if I do have to use iserror (or if(ISNA)) and/or if(isnumber), can someone give me clue as to where they should go and if there is a way to avoid the if condition?
Here's the sheet if the image doesn't do the trick.

use in F3 and drag to the right:
=INDEX(SUM(IFERROR($A4:$A*F4:F)))
or delete F3:I3 and use this only in F3:
=INDEX(TRANSPOSE(MMULT(TRANSPOSE(IFERROR($A4:$A*F4:I, 0)), SEQUENCE(ROWS(A4:A), 1, 1, 0))))

In F3 try
=SUMPRODUCT($A$4:$A$2000, $A$4:$A$2000>=0, isnumber(F$4:F$2000), F$4:F$2000)
or
=SUM(FILTER($A$4:$A$2000*F$4:F$2000, $A$4:$A$2000>=0, isnumber(F$4:F$2000)))
and fill to the right for the other columns.
See if that works?

Related

Google sheets fill in the gaps using array formula

I have this table and the date column has some blanks if the dates are the same.
i.e. B3:B6 are all 31/01/2022
I want to use column F to fill in the gaps.
I would like to use an arrayformula in cell F2 and it stops when the relative A is empty
i.e. if A279 is empty, F279 is empty too.
I tried to do it using a non-array solution
=IF(B2="",F1,B2)
and I cannot change it to array one
=ArrayFormula(IF(B2:B="",F1,B2:B))
I don't know how to make F1 dynamic and the row number is always one less then B, like showing F2 if B3, F3 if B4
This is the Sheet
Try in F2
=ArrayFormula(lookup(row(A2:A),row(A2:A)/--(B2:B<>""),B2:B))
or (better) in F1
={"Date";ArrayFormula(if(A2:A="",,lookup(row(A2:A),row(A2:A)/--(B2:B<>""),B2:B)))}
to understand how it works, pls fill for instance in I2 =arrayformula(if(A2:A="",,row(A2:A)/--(B2:B<>""))) ... if Bx is blank, we get an error, in that case lookup will take the previous value without error.

Conditional and ifs + prefix/suffix

I have something like this:
In each E cell, I would like to return the D number of that row, as long as certain conditions are fulfiled, with the preffix $ if C2=$, and suffix € if C2=€.
I have this but it's not working at all (despite it is wrong, it probably can help you understand what I need):
=IF(A2="","",IFS(if(C2="$",OR(B2="Buy",B2="Sell"),"$"&D2,if(C2="€",OR(B2="Buy",B2="Sell"),D2&"€"))))
I'm sorry if I just posted something really awful, I tried...
Thanks!
For cell E2 you can use:
=IF(AND(A2<>"",OR(B2="Buy",B2="Sell")),SWITCH(C2,"$",C2&D2,"€",D2&C2,""),"")
And drag / copy-paste the formula to the remaining rows:
Delete everything from Column E including the header. Then try placing this in E1:
=ArrayFormula(IF(A2:A="",,IF(C2:C="$",C2:C&D2:D,D2:D&C2:C)))
Understand that once you "stick" the "$" or "€" to the numbers from Column D, they will not longer be numbers capable of having math performed on them. Rather, they will become strings. Maybe that won't matter to your application, since you already have the number values in Column D; but I figured you should know this.

Google Sheets: Print output in another cell

If I use the formula: =UNIQUE(A1:A9) on the B1 cell, the column B will be filled with the unique appearances from A1 to A9. In other words: it will remove duplicates.
The problem is that if I want to order from A to Z of the column C, the formula will be moved to some other place, so it will stop working.
My workaround so far has been this:
However, you will be agree that it's not the most elegant solution.
I'd like to know if it's possible to use a formula in Z1 to print the output starting from Z3.
Is that possible?
I'd like to know if it's possible to use a formula in Z1 to print the output starting from Z3.
use in Z1:
={""; ""; UNIQUE(I3:I313)}

Sumifs in excel 3 criteria in columns

I am working on a Sumifs that has 2 different criteria in Col B and the 3rd criteria in Col F.
If all 3 criteria are met then I am going to sum the values in Col Q.
I have this so far and it returns a 0. I tried to tweak it every way I am aware of and still no luck.
=SUMIFS($Q$4:$Q$2700, $B$4:$B$2700, "=AUS", $B$4:$B$2700, "=VCO", $F$4:$F$2700, "=TRB")
The formula you provided returns 0 every time because the value in B cannot be both AUS AND VCO, it's one or the other.
As far as I know (someone correct me if I'm wrong), there's currently no way to have a conditional statement in a single criteria range (e.g. "=AUS" OR "=VCO"). A workaround could be the following:
=SUM(SUMIFS(Q4:Q8,B4:B8,{"AUS","VCO"},F4:F8,"=TRB"))
This sums the values in Q if B equals either AUS OR VCO AND F equals TRB
The problem is that you reference $B$4:$B$2700 twice. Because this column can not possibly be both AUS and VCO Column Q will never be summed.
To make this work, add a new column next to column B. Make the value of cell C4 equal to the value of B4 (=B4) and drag this formula to cell B2700 (you can also just double click on the bottom right corner of the cell to make it auto-fill to B2700). You can then use this formula:
=SUMIFS($Q$4:$Q$2700, $C$4:$C$2700, "=AUS", $B$4:$B$2700, "=VCO", $F$4:$F$2700, "=TRB")
Remember to indicate if this answer worked!

Google spreadsheet formula to resolve string as a cell

Using google spreadsheets is there a way to evaluate a cell value as the row in a lookup operation? For example rather than =D2 to grab the value of D2, I want to evaluate the value of a cell and use it as the row to lookup another cell. I've looked at the google spreadsheet formula documentation and haven't been able to find a solution.
The below pseudocode illustrates what I'm trying to do.
A B C D
1 D
2 =[B1]2 10
3 =[B1]3 9
4 =[B1]4 8
Given the value of B1 is "D" I want cells B2, B3, and B4 to resolve to 10, 9, and 8 respectively.
You might be looking for something like this:
=INDIRECT(INDEX(B$1;1;1)&ROW())
the INDEX(B$1;1;1) gets content of B1 cell (the 1;1 is obligatory parameter, since you can feed INDEX with range and means: 1st row in range;1st column in range which is D
ROW() returns current row number, be it 2, 3 etc.
& concatenates both value, so the result is processed like "D" & "2" => "D2"
INDIRECT(reference) returns reference to a cell or an area (in text form) for which to return the contents.
see https://support.google.com/drive/table/25273?hl=en
Still, depending on what is the original problem, there might be better solutions. Above one is just straightforward answer to your question.
Bearing in mind the correctness and helpfulness of PsychoFish's advice on the use of INDEX() with INDIRECT(), and on the limited usefulness of any one solution for all problems, I think the following formula will work as well in this particular case:
=INDIRECT(B$1&Row())

Resources