I'm trying to use arrayformula to expand the formula below but it's not working. When I copy-paste manually the formula into each cell it works.
=arrayformula(INDEX($1:$100,ROW(B2:B),match(YEAR(M$1:$1),$1:$1,0)))
What I want to achieve is to convert yearly salaries into monthly salaries based on years.
The spreadsheet can be viewed here:
https://docs.google.com/spreadsheets/d/1veiYh1CMIfFPwBGQk4OwKmCLa7q08TugReVfAXtpIgI/edit#gid=1363287956
Thanks!
Solution:
Since you are looking for a specific column, you can use HLOOKUP as a substitute for INDEX and MATCH:
=ARRAYFORMULA(HLOOKUP(YEAR(M1:AT1),A1:H11,ROW(B2:B11))/12)
This should yield the same result as the previous formula:
Related
I have a large Google Sheets spreadsheet that has individual sheets for financial statements of activity for multiple years. I want to reference particular columns of those in other sheets, and I've successfully figured out how to do that with an HLOOKUP function. However, because I want to do this for multiple years, I'd like that HLOOKUP function to pick up the name of the sheet to reference from its column header. Right now, I'm hard-coding it like this—you can see the HLOOKUP range refers to cells in the "2021 Overall" sheet. The hard-coded approach works but makes adding a new year tedious. Ideally, the HLOOKUP formula would read the contents of its column header cell to determine which year it is.
As best I can tell, the solution is to use INDIRECT, but I can't figure out any way to build the formulate with INDIRECT and not get an error. For instance, this seemed like it should work. As you can see, I have 2021 in cell D4, and my INDIRECT statement is referencing that and building the rest of the range.
I've also tried using INDIRECT with an explicit CONCATENATE, with no more success.
Any ideas for how to look up that D4 cell and slide it into the HLOOKUP range?
Thank you!
Try to remove the "'"& before D4 and the ' after the Overall.
Your formula should look like this:
=IFERROR(HLOOKUP($A$2,INDIRECT(F4 &" Overall!$A$5:$X$150", Utility!$A10, FALSE)))
With Nikko's nudges in the right direction, I eventually figured out the right format. This allows the formula to work in multiple sheets and to be filled right (for more years) and down (for more classes).
=IFERROR(HLOOKUP($A$2,INDIRECT("'"D$4&" Overall'!$A$5:$X$150"), Utility!$A3, FALSE))
Note that if you try to replicate this, you may need to type the formula out from scratch—I had a problem where pasting it in didn't work. Once I'd retyped it and Google Sheets acknowledged it, it worked from then on in the spreadsheet, even when pasted from sheet to sheet.
I have a VLOOKUP formula to lookup from a different sheet as below:
=ARRAYFORMULA(IFERROR(VLOOKUP(B2:B6,Sheet3!A2:C,2,0)))
I would now like to expand the data on Sheet 3 but would like the next batch of data to be in range E2:G. Is it possible to have a VLOOKUP across 2 different ranges like this?
I've done lots of google searching without any joy tonight so thought I'd ask the question on here to make sure I'm not trying the impossible.
try:
=ARRAYFORMULA(IFNA(VLOOKUP(B2:B6, {Sheet3!A2:C; Sheet3!E2:G}, 2, 0)))
i'm trying to transform data from a row only list to a row-column structure.
I got data in I:K and want to set the values from K to the corresponding cells in A:H where Date and Time Values from I & J have to match within A:H.
example sheet
Does anyone know how to do this with Google Sheet system functions?
Yes, it can be achieved by using sumifs formula, simple and straightforward, here is the formula:
=SUMIFS($I$2:$I$13,$G$2:$G$13,$A5,$H$2:$H$13,D$1)
And this is how the Gsheet look like, accept if helping you :)
I want to Use ArrayFormula for JoinText for multiple columns which have their own ArrayFormulas in Google Sheets.
My formula works for columns that have plain text values but for some reason Google Sheets gives me an error when I apply it to columns that have their own ArrayFormulas applied to them.
Take a look at the example sheet I've created HERE
Any help will be appreciated!
I hope this solution with query is helpful for you:
=ArrayFormula(transpose(query(transpose(C1:D),,2)))
(Will work faster if you know the limit of the range, e.g. C1:D10).
For implementing commas between the columns you can use
=ARRAYFORMULA(IF(C1:C="",D1:D,if(D1:D="",C1:C,C1:C&", "&INDIRECT("D1:D"))))
I put this formula in cell I2 on your sample sheet. It should be relatively fast for many thousands of rows.
=ARRAYFORMULA(SUBSTITUTE(TRIM(C2:C&CHAR(10)&D2:D),CHAR(10),", "))
This conditional format command shows duplictes on the Sheet1 perfectly:
Appliy to range A:A
=COUNTIF(A:A,A1)>1
Is it possible make it work with Sheet2 at the same time. I've read that INDIRECT could help but I don't understand how to do that.
I tried this with no luck:
If you want it to check both sheets for duplicates, you can still use almost the same formula, but you have to put the references into an Indirect statement:
=countif(INDIRECT("Sheet1!A:A"),A1)+countif(INDIRECT("Sheet2!A:A"),A1)>1
as mentioned in the documentation