I have 2 columns in a sheet that are referencing another dynamic sheet which has new rows added at the top all the time.
I want column A to be a copy of column A in Sheet1, so this works to put in cell A1:
={Sheet1!A:A}
However, I want column B to a formula applied to every row in column B of Sheet1. Problem is, when I put in a a formula, e.g.
=formula(B1)
then it changes to
=formula(B30)
when 29 new rows added
I want it to stay as B1, but it won't. If I use an absolute reference $B$1 then I can't copy the formula down the column.
Any wizards out there to help me out?
If you want to get the matching row from a column of another worksheet, then use INDEX and ROW, like so:
=FORMULA(INDEX(Sheet1!$B:$B, ROW(), 1))
This will always return the value in Column B of Sheet1, on the same Row as the formula is in on Sheet2 - even if you insert rows at the top of Sheet1
You can do "partially absolute reference" (I don't know the correct way of saying this).
You can lock only the column so would be =$A1 which means that it will never change the column but when you drag down the formula, it will change to =$A2, =$A3...
Or you can lock only the row typing =A$1 This way it will be locked on the row only.
You can do this also by pressing F4 several times: 1 time will lock both, the 2nd time will lock the row only, the 3rd time the column only and the 4th time will delete the locking.
the proper way would be to use INDIRECT like:
=INDIRECT("Sheet1!B1:B")
Related
I want to auto increment column A if column B is not empty.
For example if I type anything to B14, I want A14 to auto increment.
How can I do this?
if B column is not interrupted by an empty cell you are good with just:
=SEQUENCE(COUNTA(B2:B))
If column B is interrupted (or even not) by empty cells you could use
=INDEX(IFNA(VLOOKUP(ROW(A2:A),
{FILTER(ROW(A2:A),(B2:B<>"")),SEQUENCE(COUNTIF(B2:B,"<>"),1)},2,0)))
Here are some methods that may suit your needs...
This will auto-sequence while jumping blank rows, so will be the number of filled cells/rows:
=ARRAYFORMULA(IFERROR(MATCH($B$2:$B&ROW($B$2:$B),FILTER($B$2:$B&ROW($B$2:$B),$B$2:$B<>""),0)&"."))
This will auto-sequence while skipping blank rows, so the number will be the row of data (not the row number):
=ARRAYFORMULA(IF($B$2:$B<>"",ROW($B$2:$B)-ROW()+1 & ".",""))
or:
=ARRAYFORMULA(IF($B$2:$B<>"",SEQUENCE(ROWS($B$2:$B))&".",""))
And this will autofill every row up to the last row with a value:
=ARRAYFORMULA((QUOTIENT(SEQUENCE(SUMPRODUCT(MAX(($B2:$B<>"")*(ROW($B2:$B))))-1)-1,1)*1)+1)
I am trying to use UNIQUE= to grab unique values in a section of 11 rows from an XML parse. Every column I want to target the next set of rows down the column but I'm not sure how to do this automatically, dragging the formula (auto-fill) doesn't work.
Here is a link to my sheet with the UNIQUE formulas I have so far. You can see they increase by 11 each time. How can I continue that pattern without creating a new formula each time.
=UNIQUE($A2:$A13)
=UNIQUE($A14:$A25)
=UNIQUE($A26:$A37)
Here is my Google Sheet so far.
https://docs.google.com/spreadsheets/d/1y1cGi0Qy6a6PiQtQUrb5FQ99V31c_tEGi4aLvktxShE/edit?usp=sharing
Any help would be greatly appreciated!
paste in B2 and drag to the right:
=UNIQUE(INDIRECT("A"&2+(COLUMN()-2)*11+COLUMN()-2&":A"&13+(COLUMN()-2)*11+COLUMN()-2))
It looks to me like the whole thing can be done in one formula. Try creating a sheet from scratch and putting this in cell A2...
=ARRAYFORMULA(HLOOKUP("X",{"X";IMPORTXML("https://www67.myfantasyleague.com/2020/export?TYPE=schedule&L=14002&APIKEY=&W=1&F=&JSON=0","//matchup/franchise/#id")},SEQUENCE(1,14,0,12)+SEQUENCE(12)+1))
If I have column A receive 1000 rows of input and column B has some function that takes column A cells as input for some custom function. How do I control how many cells in column B can run at a time? For example
Column A receives input into rows 1-1000. Column B has rows 1-5 trigger. In order words, how to setup concurrency control for columns?
Edit: Referring to the picture - I will paste in 1000 cells of data into column A. I need column B to only process X rows/cells at a time.
based on your picture... if you want to process only 20 rows out of 1000 you could maybe try:
=ARRAYFORMULA(FUNCTION(A1:A20))
ofc if your Function supports the ArrayFormula variation
I'm having trouble writing a VLOOKUP to sort some data.
I have one table that has data that looks like this:
MarkAsOfDate MaturityDate ZeroRate
05-May-15 05-May-15 0.006999933
05-May-15 06-May-15 0.006999933
05-May-15 05-Jun-15 0.008996562
05-May-15 06-Jul-15 0.008993128
... ....
I want to make a table with every instance where the interval between the dates in the first and second columns is exactly one month (such as 05 - May - 15 and 05 - Jun - 15), and with blanks where no such value exists.
So I made a second table which looks like:
MarkAsofDate MaturityDate Zero Rate 1M
5-May-15 5-Jun-15
6-May-15 6-Jun-15
7-May-15 7-Jun-15
8-May-15 8-Jun-15
9-May-15 9-Jun-15
.... ....
I want to populate this table using data from the first table. I've tried to write a VLOOKUP for it but I'm not sure how to do it with two columns instead of one.
Thanks in advance.
Vlookup has some limitations, as you're starting to see. Another suggestion is Index/Match. Use this in your second table.
Note: I assume your top table is in Sheet1. Put this in your C2, in the second table (under the "Zero Rate 1M" header):
=Index(Sheet1!$C:$C,match(A2&B2,Sheet1!$A:$A&Sheet1!$B:$B,0)) and enter by pressing CTRL+SHIFT+ENTER.
There are a lot of ways to do it - if your data is sorted first by MarkAsofDate and then by Maturity date, the simplest method will be to add a helper column on your raw data tab - let's say column E. In column E, starting at E2 and copied down, type [Assuming MarkAsofDate is column A & MaturityDate is column E]:
=IF(MONTH(B1)-MONTH(A1)=1,A1,"")
This column will show the MarkAsOfDate for every item which has a MaturityDate 1 month after the MarkAsOfDate; for all other rows it will show "".
In your special data results tab, use the MATCH function to find the row in column E which matches your current row's MarkAsOfDate. We will also use the INDEX function to return the value from that row in column C. Assuming your first sheet with raw data is sheet1 and your special data results is on sheet2, type this into E2 on sheet2 and drag down:
=INDEX(Sheet1!C:C,MATCH(A2,Sheet1!A:A,0))
Another alternative (apart from BruceWayne's recommended Array Formula) would be to use the OFFSET function. OFFSET creates a new range based on a starting point, moving a number of cells to the right/left/up/down, for a given height and width. In this case, we will first use MATCH to find the first time that the MarkAsOfDate on Sheet1 matches Sheet2. We will use that info and the OFFSET function to create a new range which starts there, and ends at the bottom of your data, like so:
=OFFSET(Sheet1!A1,MATCH(A2,Sheet1!A:A,0),1,COUNT(Sheet1!C:C),2)
Then we just need to use VLOOKUP on the range we created above, like so:
=VLOOKUP(B2,OFFSET(Sheet1!A1,MATCH(A2,Sheet1!A:A,0),1,COUNT(Sheet1!C:C),2),0)
This second alternative avoids needing a helper column, but is more complex and could be prone to errors if your rows/columns change (because we had to hardcode a couple of things in the OFFSET function). Also, OFFSET is volatile, meaning it recalculates whenever any cell calculates, so it can slow down your workbook if you have a lot of rows of it. Based on that, I recommend you either use the helper column method above, or if you are comfortable with Array Formulas, using BruceWayne's answer.
I have two worksheets that have two columns of data. In column A of the Worksheets are the name of an item and in column B are the price of the item. Worksheet 1 has the price from last year and worksheet 2 has price from this year. The names of items in Worksheet 1 may or may not be in Worksheet 2.
I need a process that will match the names in each worksheet and if there is a match determine the price differential for that item. The price differential will go in column C in worksheet 2.
I have considered using an if-then function with a vlookup function but, I need to check for a match in all columns A from worksheet 1 and worksheet 2 for all the records. I believe a VB looping process may be more efficient.
Since it would appear to me you are only likely to require this once (or once a year) efficiency does not seem to be very significant, so formulae may serve.
Assuming labels (respectively: Item_Name and Price_O in Sheet1, Item_Name, Price_N and Diff in Sheet2) in Row1 then the following formulae (copied down to suit) should indicate where there is no match (with #N/A or, if there is, the price change relative to last year:
In Sheet1 C2: =IF(MATCH(A2,Sheet2!A:A,0)>0,"")
In Sheet2 C2: =B2-VLOOKUP(A2,Sheet1!A:B,2,FALSE)
Alternatively, a pivot table might provide a better overview, in combination with:
In Sheet2 H5: =IF(OR(ISBLANK(F5),ISBLANK(G5)),"No Match",G5-F5) (copied down to suit).
In Sheet2 E1 call up the PivotTable wizard (Alt+D, P if required) , select Multiple consolidation ranges and PivotTable, Next.
Select I will create the page fields, Next.
In Range select or insert Sheet1!$A:$B, Add, then Sheet2!$A$B, Add, Next, select Existing worksheet and enter =$E$3, Finish.
Right click on table and if necessary change Σ Values from Count of Value to Sum of Value (by left clicking on Count of Value, left clicking on Value Field Settings… and selecting Sum in Summarize by), OK.
Right click on the table, left click on PivotTable Options, left click on Totals & Filters and if necessary untick Show grand totals for rows, OK.
If necessary, right click on PriceN in the table, Sort, Sort Z-A.