Vlookup formula in excel - excel

I was hoping someone could offer me a little help please on a formula. In one of my cells I use a vlookup to search for the colour in B12 and match it to the colour on another worksheet called cars.
Now this works perfectly fine, but after running the formula I have to select the last row of data and press control & d, or drag down the cell up until the last cell, my question is that is it possible to add this forumla into the cell and have it automatically run all the way down to the last row of data? my forumula is
=VLOOKUP(B12,coloursc:carsc,2)

You can use an Excel table for your data entry. Formulas and formatting will automatically be applied to any new row in the table. You no longer need to manually copy down or pre-fill empty areas of the spreadsheet with formulas.
Learn more about tables in this Microsoft article and this tutorial on Contextures.com

Related

Is there a way to drag formula down but changing the column

I'm trying to make a summary which list out all the matches and do a transpose of the table. I wrote a formula which works successfully. But, I come into another problem, which I find my formula cannot be dragged down and apply to all rows. Can anyone assist me in improving my formula?
Source:
Summary:
I would want to drag down the rows in "My summary" and the formula can do the columns+1 automatically. Appreciate for your help.
Here's my formula:
=IFERROR(INDEX(Sheet1!$F$9:$F$16, SMALL(IF(Sheet1!$H$9:$H$16="X",ROW(Sheet1!$H$9:$H$16)-ROW(Sheet1!H$9)+1),COLUMN(A1))),"")
In your screenshot it's difficult to tell which rows the data lives in. The following formula has been entered into Sheet2, cell B2 and copied down.
=IFERROR(TRANSPOSE(FILTER(Sheet1!$F$9:$F$16,INDEX(Sheet1!$H$9:$K$16,1,ROW(A1)):INDEX(Sheet1!$H$9:$K$16,8,ROW(A1))="x")),"")
Source screenshot Sheet1
Result screenshot Sheet 2
This approach uses Excel's Dynamic Array functionality, available only in Excel license with Office 365. The formula is only in column 2. It automatically spills its results into the neighboring columns as required.
edit after comment
If you don't have Office 365, you can use a variant of your formula, where the Index is replaced by and Index():Index() technique. The first Index pulls the first row, the second Index pulls the last row and the two results are combined with the range operator : that combines the two results into a range.
=IFERROR(INDEX(Sheet1!$F$9:$F$16,
SMALL(IF(INDEX(Sheet1!$H$9:$K$16,1,ROW(A1)):
INDEX(Sheet1!$H$9:$K$16,8,ROW(A1))="X",
ROW($A$9:$A$16)-ROW(A$9)+1),COLUMN(A1))),"")
Start in the first result cell (B2 in my screenshot) and use Ctrl+Shift+Enter to confirm, since it is an array formula. Then copy across and down.
Note: screenshot results are different, since I recreated the sample from scratch and the source data is different.

How to auto fill a specific complex formula after inserting new row to a defined Excel table

I've been looking for a way to automatically insert a row, where a column contains an Index(Match) formula.
I've looked at several tutorials and forum where it says formulas should auto populate because it's part of the Excel table function, especially if auto-fill feature is enabled. However, my formula is the following, and will not process.
=INDEX('Lookup Tables'!$M$20:$M$26,(MATCH(**H2**,'Lookup Tables'!$N$20:$N$26,0)))
This formula is in Cell G2. Adding info into cells G3, G4 would make the following formula on the column to the right.
=INDEX('Lookup Tables'!$M$20:$M$26,(MATCH(**H3**,'Lookup Tables'!$N$20:$N$26,0))),
=INDEX('Lookup Tables'!$M$20:$M$26,(MATCH(**H4**,'Lookup Tables'!$N$20:$N$26,0)))
Basically, when a new value is entered on H3, H4, H5, etc, the =index(match) formula should automatically populate, but this doesn't work.
I thought of just adding an =iferror(Formula," ") but that just expands the table indefinitely and adds too many blank columns (my table has over 20 columns).
Only way I could think was to write a VBA script, but I'm stuck on what to do or where to even start.

If a cell in column A in sheet 2 equal to a value from sheet 1 then return the values from sheet 2 to column B and c in sheet 1

I am looking to do a kind of automatic cell updates on excel, which is a status update for a product we got and the location of the product in the warehouse.
I have basic knowledge of VBA and I didn't manage to code anything to help me with that. I tried to use If function, but didn't make sense because I can't find a way to achieve what I need.
Here is sheet 1
and sheet 2
examples.
This is what I am trying to achieve:
if a cell within Sheet2 column A range = Cell A2 in sheet 1, then fill Sheet1, B2 cell and Sheet1, C2 cell with the information from sheet2 on the condition that it is the most recent entry (in the example images it is the entry with the dispatched status)
Would you recommend VBA or using formulas, and if so what should I do?
This can be done with formulas, however getting the latest value isn't as easy as it seems. This can be achieved however by following this tutorial for reference. I especially refer to the part using LOOKUP(.
Other than that, all you need to do is set your ranges to refer to the correct sheet.
=IFNA(LOOKUP(2,1/(Sheet2!A:A=Sheet1!A2),Sheet2!B:B),"")
My formula in B2 is:
=INDEX(Sheet2!$B:$B;MAX(SI(Sheet2!$A:$A=Sheet1!A2;ROW(Sheet2!$A:$A)-MIN(ROW(Sheet2!$A:$A))+1)))
My formula in C2 IS:
=INDEX(Sheet2!$C:$C;MAX(SI(Sheet2!$A:$A=Sheet1!A2;ROW(Sheet2!$A:$A)-MIN(ROW(Sheet2!$A:$A))+1)))
Both formulas are array formulas so instead of entering them with ENTER, they must be entered pressing
ENTER+CTRL+SHIFT at same time
Anyways, these formulas will probably make your file heavy and slower. Think about redesigning the way you save data, and consider adding a date field, and resuming data with Pivot Tables.

How to stop Microsoft sheets from skipping a row with my formula when a new answer is entered on Microsoft forms

Got a formula (shown below) that I am trying to apply to Microsoft form answers. Microsoft forms appears to automatically insert a new row with every submitted answer which prevents the formula from working on the correct referenced cell. Is there a formula on Microsoft excel online that will reference correctly when the form inserts a row?
If I manually drag formula down it updates properly and shows correct cell reference. Tried importrange and query to link the data from the form excel sheet to another sheet but these functions aren’t included on excel online. I also tried indirect function but I could not modify my existing formula to work with it.
=IF(RAW!M2<>””,RAW!M2,””) This formula transfers data from “RAW” data sheet to a separate sheet and leaves cell blank if no entry is found in the source cell.
If inserting rows breaks references, you can use Index with a row number.
Instead of
=IF(RAW!M2<>"",RAW!M2,"")
use
=IF(Index(RAW!M:M,row(A2)<>"",Index(RAW!M:M,row(A2),"")
When copied down, the reference to A2 will change from A2 to A3 and so on and the returned value will change accordingly. The formula will always return the value from row 2 if the formula references Row(A2), regardless of rows being inserted or deleted.

Excel Formula Referencing

quick excel question:
If I put values in cell B1 and B2.
Then write the following formula in cell A1:
=$B$1-$B$2
then I highlight cells B1 and B2 and move them to column C. the formula in A1 automatically adjusts for the move ie. formula now becomes:
=$C$1-$C$2
How would I get it to stick to column B and not switch to column C. I tried searching google but did not get right answers (probably am not phrasing question correctly).
The context of my problem is that formulas in one sheet are being calculated based on month end data which is placed in another sheet. Now I need to add April month end data. So I shift the old data to the right and input April's data, but the formulas are automatically adjusting for the shift and still refer to March's month-end data. This despite the formulas using absolute referencing.
Thanks for any help provided
The formula you are looking for is
=INDIRECT("B1")-INDIRECT("B2")
This will always refer to Cells B1 and B2 regardless of what you to do move the cells or add new columns etc.
This will allow you to simply insert a column for the new month.
Not a good spreadsheet design, you should really add new data to a new column.
However, if you are determined to stick to that design, copy and paste the old values to a new column, then delete the originals. Formulas will not be alterd by that.

Resources