I have this formula working in Google Sheets:
=if(B3="",0,IF(ISERROR(VLOOKUP(E3,E4:E,1,FALSE)),1,0))
The logic is pretty straight forward:
if B3 is NOT NULL and there is no duplicate of E3 in range E4:E, write 1 else write 0
I tried to convert it to ARRAYFORMULA, coz it should be applied to all columns in E as and when the number of rows increase (via form submission), by doing this:
=ARRAYFORMULA(if(B3="",0,IF(ISERROR(VLOOKUP(E3:E,E4:E,1,FALSE)),1,0)))
But, it wrote 0 to all columns of E.
The reason here is that, the VLOOKUP should look in the E column range excluding the current row. I'm not sure how to achieve this.
Here is the Google Spreadsheet (please refer to Sheet2)
Can someone please correct my ARRAYFORMULA? Thank you.
You can't offset range used in ArrayFormula, so your original formula cannot be converted into ArrayFormula and remain result. But you may use this workaround:
=ArrayFormula(IFERROR(--(VLOOKUP(OFFSET(E3,,,COUNTA(A3:A)),QUERY({ROW(INDIRECT("A1:A"&COUNTA(A3:A))), OFFSET(E3,,,COUNTA(A3:A))},"select Col2, max(Col1) where Col2 <> '' group by Col2 label Col2 '', max(Col1) ''"),2,0)=ROW(INDIRECT("A1:A"&COUNTA(A3:A)))),0))
I used row function in this formula to compare it with maximum row when certain value appears.
Your sample file
Related
I have an excel spreadsheet where it has duplicate column header titles labeled "'H ". I'm attempting to calculate the sum of a row if it is under this certain header value. I tried pivot tables but it hasn't worked too well.. I feel as though I'm not using the sumif properly.
Please help this excel beginner!
This is what I used so far:
=SUMIF(B$2:$M5, B$2:$M5="'Q ", B6:M6)
above is what my data would look like, below is the summary that I would want
Based on your image, and assuming it starts on A1, use this code in Cell B5 and copy it to the right.
=SUMIF($B$1:$G$1,B$4,$B$2:$G$2)
so the SUMIF function requires three values:
the range which you are searching.
the criteria (value) you are searching for.
the range which you want to return for your sum.
so in your case, I think it might look like this if you are searching column headers to find values in the columns/rows below them:
=SUMIF($A$2:$A$10,$A$1,B2:B10)
This would return the sum of all cells in row B that are under column headers shown in the range A2:A10 with the value shown in A1 (you can change the value in A1 to "H", "Q", or whatever you like). You could copy this formula down for all of the rest of your rows if you have multiple rows to find values for.
Hopefully this helps.
JW
I have a Table in excel like the following one:
col1 col2
A 1
B 0
A 2
B 2
B 3
I was not able to find a way to select a subset of the table like this one using an excel function.
col11 col22
B 0
B 2
B 3
based on the value "B" of column col1 or just be able to select the col22' from the given subset.
I would like to have a solution that does not require to VBA nor array formula. I found on Internet the function FILTER, but it is not available yet and Structured References does not have such functionality.
I would like to use for example the result col22 as a column at another place of my spreadsheet. Other languages such as R, provide a function subset that does this in a pretty simple way. In excel it is really easy to filter using the Excel interface (filter button), but I am not aware of a function that does something similar programatically.
I had the same problem and the only thing I found on the internet was the FILTER function too.
I wanted to vlookup a subset of a table based on another column. My solution was to make another column that is the concatenation of the two. Then I used vlookup on this column.
I don't know what are you going to do with the subset table that you want to have. But you can do it in a different way as I did. May it helps.
Assuming col1 is A and col 2 is B and your result set's col1 and col2 are E and F respectively, try this formula in column C: =IF(A2=$E$2,MAX($C$1:C1)+1,0)
Now, in cell E2 (i left the first row for a header), i physically typed "B" to make this the input source and allowing for dynamic reporting. for as many cells below that as you wish, the following formula will only show the total number of "B"s that are in your input source: =IF(ROW(A2)>MAX(C:C),"",E2) Notice i did not fix the cells with $ as your following row depends on the former.
Cell F2 (the top of your col2 field for the result set) include: =INDEX(B:B,MATCH(G2,C:C,0)) and in G2 put: =IF(E2="","",G1+1) and copy both down as far as you have formulas in column E (or result set col1).
The reason for the IF statements is for formatting rather than displaying errors on failed lookups.
Goal: extract a subset of the current sheet only when values in the first column match a value in the first column of another 'Sheet1':
=VLOOKUP(A2,Sheet1!$A:$B,2,FALSE)
Add the formula above in the first cell of the first empty column, then sort Z-A this column and remove all "#N/A" rows, then re-order again A-Z the first column and remove this temporary column.
I can't get my head around the formula required to return a list of data from all rows in excel that fall between two specific dates.
Sheet1 contains the following data:
Date Region Reference
01/01/2015 B 4458
01/02/2015 B 6635
01/02/2016 A 3175
01/03/2016 C 2458
01/03/2016 A 2194
01/04/2016 A 3594
01/04/2016 C
01/05/2016 C 1654
12/05/2016 B 3648
01/06/2016 B
01/06/2016 B 3296
In Sheet2, I specify a start date in cell C2 and an end date in cell C3.
I would like to display a list in sheet2 that gives me a list of all reference numbers in sheet1 that fall within that date range. I will also however want it to ignore any cells that are blank and do not contain a reference number.
I've tried a few things to get this working, and I think an array formula using an INDEX function is probably the best bet, but I'm struggling to get the date range aspect to work.
Is anybody able to help please?
Thanks
I would advise that you format your data as a table if you haven't already as it makes the index function much easier to read.
The formula below should do what you require. The * in the if statement is like an "and". -4 near the end of the formula is the number of rows betwen the source table and the top of the sheet it's on. The last 1 at the end of the formula is the column that you want to take data from much like you have in a vlookup. remember to use SHIFT+CTRL+ENTER to make it an array formula.
=IFERROR(INDEX(Table1,SMALL(IF((Table1[Date]>=$C$2)*(Table1[Date]<=$C$3)*(Table1[Reference]<>""),ROW(Table1)-4),ROW(1:1)),1),"")
Formula if you don't want to format as table
=IFERROR(INDEX(Sheet2!$C$5:$E$15,SMALL(IF((Sheet2!$C$5:$C$15>=$C$2)*(Sheet2!$C$5:$C$15<=$C$3)*(Sheet2!$E$5:$E$15<>""),ROW(Sheet2!$C$5:$E$15)-4),ROW(1:1)),1),"")
Using the formula
I't not advisible to copy and paste this formula from one cell to another but instead copy the formula text and paste it to avoid parts of the formula changing.
keep an eye on the ROW(1:1) at the end of the formula, it specifies which row from the matching results will be extracted from the data and it should increment when you autofill the formula down the sheet.
I have two Excel sheets - both have these columns:
Col 1 Col 2 Col 3
In the first sheet, I also have an additional column at the end which will be a formula to see a row with the same three values as above exist in the other sheet. If the row can be found, I want to display 'Yes', else 'No'. I've toyed with VLOOKUP's etc but no joy.
Any tips?
If your version of Excel have COUNTIFS, then that should do the trick.
If you don't have countifs formula, you can do the poor man's version (what I did with Excel 2003 way back when) and combine the columns. So in Col4, put formula
=Col1 & Col2 & Col3
Then you can place your Yes/No If formula in Col 5. Suppose the three data points are named cells (this, that, the). The formula would look like:
=IF(Col4 = this & that & the), "Yes", "No")
I'm trying to do something in Excel without using VBA macros. I suspect it is possible, but have some up empty so far. Basically for values in a table, I'd like to retrieve a list of all values in Column A conditionally where Column B equals a value I provide.
For example I'd like a function that essentially returns a range/description of cells for Column A if Column B is equal to zero.
Column A Column B
1 0
2 0
3 1
4 0
would return a range describing cells a2, a3, and a5 (1, 2, 4). I'd prefer to be able to do this using a formula, and not manually using pivot tables. I would be willing to create a view of the data using pivot tables if that table could then be referenced via a function to give me the appropriate results. I am also able to sort Column B in any way if it makes it easier to do this.
Ultimately I need to pull out a random value from Column A that meet the criteria of Column B in case that matters in the final solution.
Thanks.
Use an array formula.
Type in:
=INDEX($A$1:$A$4,SMALL(IF($C$1=$B$1:$B$4,ROW($B$1:$B$4)),ROW(1:1)),1)
then press Ctrl+Shift+Enter. Drag and fill the cells below until #NUM! shows up. This formula assumes the value you're looking for is in C1 and there are no headers (data starts in 1st row rather than 2nd).