Comparing arrays using IF - How to get rid of empty spaces in final result? - if-statement

I have 2 columns in Sheet 1 (named Projects), "Projects" in column A and "Status" in column B. The number of rows is dynamic.
In Sheet 2, I want to extract the projects that meet a certain string criteria and populate a table. For example, if the Status is "Operating", take the project name in column A for that row and put it in a table.
I tried =IF(Projects!B1:B="Operating",Projects!A1:A,"") but it returns the names of the projects in the same row position as in Sheet 1. So if there is a 2 row gap in Sheet 1 between two operating projects, it keeps the 2 row gap in Sheet 2.
How do I get rid of the gaps?

There are some ways to accomplish this.
First solution - based on code you have provided
Your code: =IF(Projects!B1:B="Operating",Projects!A1:A,"")
After some tweaks (working):
=FILTER(
ArrayFormula(IF(Projects!B1:B="Operating",Projects!A1:A,"")),
ArrayFormula(IF(Projects!B1:B="Operating",Projects!A1:A,""))<>""
)
As a bonus - you need this code only in one cell
Picture:
Second solution (elegant and fast one)
You need only this:
=QUERY(Projects!A1:B,"select A where B='Operating'")
Picture

Related

How to alternate values of a =textjoin range in spreadsheets

first of all excuse my poor English, I'm trying to get the exact words to summarize my problem.
I'm trying to make a formula to concatenate a big range of cells by alternating its crossed values.
If you see the image, I have some titles (3rd row), and some variable values for each column from B to D, in the rows 5 to 7. The number of columns and rows will expand in actual project. Then, I need to summarize all crossed data to make some processes later: I need the output written at column F, where I get the title and then the cell value.
If I use =TEXTJOIN(",";;"$B$3:$D$3;B5:D5) I get the output at H5, but It makes me to get many problems later at processing information.
I have tried to make some extra columns or cells concatenating content of each "title" and "value", and then, joining everything, but it's a poor solution if I'm trying to build a sheet with hundreds of columns. I'm sure there would be another better solution, but I can't figure out by now.
your formula should be:
=ARRAYFORMULA(SUBSTITUTE(REGEXREPLACE(TRANSPOSE(QUERY(TRANSPOSE(
IF(B5:D<>"", ","&B3:D3&","&B5:D, )),,999^99)), "^,", ), " ,", ","))

OpenOffice Calc: Counting unique strings in cell range

I'm trying to find a way to calculate the number of unique strings in a single column, excluding blank cells. So far I've seen solutions such as the following:
=SUM(1/COUNTIF(X2:X99;X2:X99))
Plus another similar formula using FREQUENCY instead of COUNTIF. However, applying this to my spreadsheet gives me a decimal value that has no apparent meaning. For example, if my column contains 20 cells containing "ABC", and 30 cells with "XYZ", I should have an output value of 2. However, this is not the case, and even I can clearly see that the above formula won't output anything larger than a 1, which has left me rather confused as to its usage.
Pivot tables seem to show the most promise, but I can't get that to work either. Here's what I tried:
Select the column, including the header
Select a new pivot table and use the selected range
Drag the header from Available Fields to Row Fields
Select the ignore empty rows option
Create the table
This then creates a table with one row per unique entry in the first column, and an empty second column. One row below is a Total Result cell, with the adjacent cell empty.
From this, I can see that there must be some sort of capability of the software to find unique strings, so it would stand to reason that there must also be a way of counting them and displaying that value in a cell. The question is, how do I do that?
Your first attempt should work if (a) wrapped in SUMPRODUCT and (b) the range does not contain blank cells:
=SUMPRODUCT(1/COUNTIF(X2:X51;X2:X51))

Same row different column. Excel Formula

If is possible with the if(indirect formula to give me the value from the same row but from a different column if a specific cell is from that row?
More specific: I want cell =Sheet2!F23 to give me =Sheet1!N11 if =sheet2!C23 is from Sheet1!B11.
The important thing is the I need it to come from row 11 but from a different column.
Thanks in advance.
I did the following:
On Sheet 1 i gave all the rows a unique number in column A
On sheet 2 i just put in the unique number(C23) and the rest of the cells on that row used the formula below with. The only thing i needed to change was the index of which column needed to be matched.
It might not be the most efficient way but i worked for me.
=IFERROR(INDEX(Sheet1!B:B;MATCH($C23;Sheet1!$A:$A;0));"")

Adding more condition to Vlookup

I want to use vlookup formula with 2 scenarios:
Example: I have sheet 1 with full data and Sheet 2 with other information. In sheet 2 I want to pull those records which exists in sheet 1 with vlookup. I have already wrote that query for vlookup. In same I want to add below conditions:
1) column c2,A2 & G2 of sheet2 are matching in any row of Sheet 1.
My vlookup formula is this:
=VLOOKUP(A2,Sheet3!$A$2:$J$20332,10,FALSE)
There are duplicate rows in column A and thats why it is not working as a primary key. Kindly share your thought.
You should be able to construct a primary key by linking together all the information which will create a singular entry.
Given the limited info you provided I would go with creating in both sheets a new column with:
=A2&C2&G2
You could then do a vlookup based on this singular value and get the information from one sheet into the other.

How to sum entries that have same ID OpenOffice - Calc

I have a spreadsheet similar to the one in the screenshot.
From this I want to sum all the entries in Data 2 which have the same Data 1 ID and store it in another column. So something like this:
I am not able to figure out the formula which would do this. I figured out how to get a column with unique entries I just need to figure out how to get the sum of the values which have the same data 1 id.
Can someone point me in the right direction?
You can use SUMIF, e.g. if I'm reading your sheet right, =SUMIF(A$2:A$7, A11, B$2:B$7), and then copy down. This sums the values from B2-B7 whenever the corresponding value in A2-A7 matches A11.
You can find more on SUMIF here.
you may use subtotals function under the Data tab, although it gives you the answer in the row below all the cell matching your id; then you have to click the - and + buttons that appear on the left...you may see these in this picture of my data
this is a nice resource when you have non-English characters(á, ó, ß,...), spaces, dashes and points, so it becomes difficult to process with sql