Fill formula column wise when drag down by column in Excel - excel

I want to fill up a column of values using xlookup(). Please see the example below.
Typically the formula will automatically change parameters as I drag down the column but it only works if Var1-Var6 are populated by rows. But in the raw data Var1-Var6 are in columns (and cannot be easily transposed due to other constrains). I am wondering how I can make the formula automatically loop through column B to G when dragging down the column.

Use INDEX:
=XLOOKUP($J$4,$A:$A,INDEX($B:$G,0,ROW($ZZ1)))
Now as it is dragged down it will change which column is returned.
with Office 365 we can also use filter and transpose:
=TRANSPOSE(FILTER(B:G,A:A=J4))
put that in the first cell and it will spill the results

Related

Get differences between two columns in Excel

I would like to compare two columns in Excel and get the list of elements that are present in the first column, but not the second one. The same elements are not in the same rows. My table looks like this:
The expected output would be records "aadapa" and "acaso", since these are only two elements not present in the second column. "aklepac" and "apniewsk" are in the second column only, so shouldn't be outputed.
I would appreciate any help with this case.
If your columns are Column A & Column B, you can enter the following formula in Cell C1:
=IF(COUNTIF(B:B,A1)=0,A1,"")
The drag it to fill down and whatever doesn't appear in the second column will be listed in this column.
With the new Dynamic Array formulas(Currently only available to Office 365 Insiders) simply filter column A with countif:
=FILTER(A1:A4,COUNTIFS(B1:B4,A1:A4)=0)
Put that in the first cell and Excel will spill the rest down.
With Current versions we can use INDEX/AGGREGATE:
=IFERROR(INDEX(A:A,AGGREGATE(15,7,ROW($A$1:$A$4)/(COUNTIFS($B$1:$B$4,$A$1:$A$4)=0),ROW(1:1))),"")
But this requires that the formula be placed in the first cell and copied down till blanks appear.

Structured references vs explicit cell references

I'm using Index-Match to match Full Names with head count in that party.
I have it working but it uses both the structured and explicit cell reference.
I can't figure out why when I add a new row in my table, the column with the index-match formula wont populate the last row.
This is the formula used:
=IFNA(INDEX(AA:AA,MATCH([#[Preferred Seating 1st Choice]],D:D,0)),"")
Column AA has the head count number and column D has the list of full names.
Preferred Seating is the column used to reference the search.
I looked around and can't seem to find why it wont fill in the last row after that rown info is entered.
I can only assume it has something to do with the mixed Explicit-structured cell/column references. Any help please.
Yes Excel may not automatically assume a formula needs to be automatically filled in an entire table column if it contains unusual references. Unless you have data outside the table, you should just refer to the columns in the table:
=IFNA(INDEX([Column AA Name],MATCH([#[Preferred Seating 1st Choice]],[Column D Name],0)),"")
These can be easily entered when editing the formula by selecting all cells in the source columns excluding the heading. The formula will always use the entire
source columns and the formula should automatically fill its own entire column.
You can also control whether a column automatically has its formula updated through a hidden property. The ability to change the behavior of the column only appears through the front end when you're making changes to the column.
After entering a formula in a column, Excel will either automatically fill the entire column and give you the option to turn off the automatic fill, or Excel will not automatically fill the entire column and give you the option to turn it on.
After entering a formula that isn't being filled, this icon will appear:
Click it and then select to Overwrite all cells in this column with this formula
Deleting a formula from one cell in a column that is being automatically filled will turn off the automatic fill. Double clicking a cell with a formula and pressing enter will give you the option to turn it on again.

Fill dates array and add dummy variables

I have a column with dates called "dates". This column contain dates from 01.01.2010 to 31.12.2010. it should have about 365 rows, but it actually has only 231 rows, because the data was not collected regularly. The others are missing, and I'd like to fill the gaps in time.
How can I fill the array of this column with the missing dates? I want to add 134 rows in the place of the missing ones, filling in the missing dates.
Create another sheet and put all the dates in column A in your new sheet.
Make sure your sheet with the data in it has the data column all the way on the left (important for how Vlookup works)
In your new sheet, starting in Cell B2 put numbers 1 through however many columns you have in your data sheet along that top row.
In your new sheet use Vlookup to find all the rows where there are data
=VLOOKUP($A2,DataSheet!$A$1:$C$20,B1,FALSE)
Note that the lookup column ($A1) is locked in to the column but not the row and that the range you are looking up is locked in in all directions. This will allow you to drag to the right/down and fill everything in.
Drag to the right then drag all the way down.
there will be #N/As where you cannot find a match which you can suppress with either an IF statement of conditional formatting. But now you have a row for every day with blanks when there is not data!
I found a solution with a similar formula, but the result was the same.
First, I got the two columns of data—"date" and "values" in the columns A and B of the worksheet. Each consisted of 231 rows. Then, I spread a full array of dates—365 in a new column D. Finally, I used this formula:
=VLOOKUP(D2;$A$2:$B$1056;2;FALSE)
in C2 and obtained the only the values from column "values" corresponded to the new dates of column D.
Thanks for Brad's answer for directing me to the VLOOKUP function.

Trying to select rows that matched in vlookup excel

I am trying to select the rows of the results from my VLOOKUP and put the results in a neat table in another sheet. The row in my "M" column has a lot of NA and random numbers that were matched.
See this image for clarification:
I want to select all the rows that returned a result and move those rows to another sheet in a table without blank rows between the results. I am not sure how to do this but I know a resident stackoverflow pro probably thinks this is cake. Thanks for the help in advance!
You could make use of a filter:
Select your table and put a filter (under Home tab, Sort & Filter).
Uncheck the #N/A in the selection filter (click the little grey box with black arrow for the column where there are the #N/A that appeared when you inserted the filters).
Copy and paste everything you need into the other sheet.
You can do this with some formulas:
In the column next to your VLOOKUP (I assume it's column C) place a 'counter formula'- in D2, place =IF(ISERROR(C2),0,1), in D3 and below: =IF(ISERROR(C3),D2,D2+1)
Create a new table (say in starting in column F in the same sheet)
In the first column of the table, just place increasing numbers (e.g. in F2: =ROW()-1)
In the next columns, use INDEX/MATCH to retrieve the results, e.g. in G2: =INDEX(A:A,MATCH(F2,D:D,0))
Done!

Excel Conditional Formatting of Dates Automatically

Is there a way for Conditional Formatting in Excel to refer to a whole column from the original reference column?
For example, i want the E column to refer to the C column such that if the dates in the E column are 2 days after the dates in the E column, it will turn green. And i want to be able to do this as fast as possible.
The problem is that right now even if the function would just be the same for the E to C column at each row, i have to do it one by one. Is there anyway to match the whole E column to the C column?
Thanks!
You can use conditional format on the first cell in the column, and use the format painter to copy it to the rest of the column. Use a formula like '=B1=A1+2' as condition for the first cell. Make sure there are no dollarsigns in the formula!
Alternatively, you could use manage rules to apply them to a range. Have a look at the pictures below. I cannot post them here because I have not enough credits yet :-)
http://i.stack.imgur.com/FA3o9.jpg
http://i.stack.imgur.com/qYcvQ.jpg
There is a function called auto fill in Excel. The auto fill function makes it possible to automatically fill in your function in a whole column with just a few clicks.
link to tutorial
Example of auto fill:
Enter 1 in cell A1
Write =(A1+1) in cell A2
Select cell range A2:A10
Click on "Fill" in the ribbon (see image)
Select Down
Now there is numbers 1-10 in columns A1:A10
You may use this feature to add cells with your function in a whole column.

Resources