Excel - Have a value from column B of a 2 column reference pasted anytime the value from column A is entered on a separate worksheet - vba

In the example I have a 2 column reference where data in column E is correlated to column F. I need the data in Column F to show up anytime data from Column E is entered in a separate worksheet if possible.
To be clear, is it possible to enter data in Column A of Sheet 1 that pulls the correlated data from column B in reference Sheet 2 and enters it into Column B of Sheet 1?
I tried using a simple function in a single sheet but it obviously doesn't do what I need.

You are after VLOOKUP or INDEX MATCH
Sheet1 b1 and fill down rows
=IFERROR(VLOOKUP(A1,Sheet2!E:F,2,FALSE),TEXT(,))
Or
=IFERROR(INDEX(Sheet2!F:F,MATCH(A1,Sheet2!E:E,0)),TEXT(,))
If you set you data up as tables the formulas will autofill down. Rather than use entire columns you can set to the ranges containing data.
Data:

Related

Populate another sheet with the same columns but only selected rows

I have three columns: in column A I have Suppliers, B has Order Dates and C has Types ("Merchant" and "FBA").
How do I populate another sheet in the same Google Sheets with the same three columns but only with rows that have "FBA" in column C?
I want them to auto-populate so when I add another row in Sheet1 where column C is "FBA", it will automatically add that row to the next available row in Sheet2. I'm guessing I use the Index formula but am unsure how to use it.
Please try something like:
=query(Sheet1!A:C,"where C ='FBA'")

look for Column heading and sum up

I have been working with a excel file with a lot of data, which is arranged in 2 sheets.
I would like to get data from sheet 1 to sheet 2 with reference to the column headings.
For example:
So if I want to find the sum of function 1 person A with criteria 1, the command have to go and find the heading "sum of function 1" in sheet 1 and choose the data that are only under criteria 1 and sum it up in sheet 2 cell D5. (By using column heading reference instead of cell reference).
The table range is A2 : U80.
Thanks.
First you have to format your data as table (select the data -> Menu Insert -> Table). Then you rename your table, for example Table1. Let's say one of the columns you want to sum on the sheet2 is called ColumnName.
On the sheet 2 you write a formula
=SUM(Table1[ColumnName])
The result will be what you are after.
You should try it by SUMIFS(). Syntax will be
=SUMIFS(AgeRange from sheet1,NameRange Sheet1, Name cell Sheet2, PlaceRangeSh1, Place Cell Sh2)
Tell me if requires further help.

Find values in a worksheet with two criteria matches, copy them and paste them to another sheet with VBA

Here is my problem:
Sheet1 = "Interface". Sheet2 = "Data".
Column C5:C160 in "Data" contains a list of tasks.
Row D4:M4 in "Data" contains a list of position types (jobs), which I have labelled with "job categories" from 1-10. The range D5:M160 contains work-hours for each task and position type.
Values in columns E and F in "Interface" are related to columns C and row 4 in "Data" through data validation.
What I want to do is create an advanced filter that can copy values from D5:M160 in "Data" and paste these in column G in "Interface", if the values in columns E and F "Interface" match the values in column C and row 4 in "Data" respectively, simultaneously.
This means that it should be a macro to copy and paste values with matching multiple criteria (two criteria) from one sheet to another.
I have tried different things, with no success. I have also tried array formulas, vlookup and sumifs with multiple criteria, but none of these seem work.
Any ideas?
I appreciate your help!
The index formula combined with match is built just for this.
Index returns a value from a specified table when you provide a row and column.
Match is used to return the row/column based on criteria.
So on the Interface sheet (assuming your data starts in Row 1) you can place the following formula in G1 and copy it down as needed.
=INDEX(Data!$D$5:$M$160,MATCH(E1,Data!$C$5:$C$160,0),MATCH(F1,Data!$D$4:$M$4,0))

How do I copy specific cells from sheet 1 and paste into corresponding rows of sheet 2 , based on values of cells in sheet 2?

I have Sheet 1 with lots of columns, where column A is the list of all customer codes. In sheet 2 I have column A as some selected customer codes. Now based on the selected customer codes in sheet2 I need to extract few columns (H,I,J) from sheet1, paste it into sheet 2 and export the result to a new sheet.
Excel noob here. Hope you understood my query.
Assuming customer codes are unique in column A (i.e., the same code does not appear multiple times) you can do all of this with VLOOKUP function.
No need for VBA. In column B, Sheet 2: =VLOOKUP(A1,Sheet1!A:J,8,False) will return the value corresponding from column H (H being the eighth column of the range A:J).
Likewise do this for column I:
=VLOOKUP(A1,Sheet1!A:J,9,False)
And if you guessed also do this for column J:
=VLOOKUP(A1,Sheet1!A:J,10,False)

Moving Data between Worksheets based on a key

In both worksheets I have a key in column A. Not all of the key values are in both worksheets.
For each key value in column A of Worksheet 1, I want to find the corresponding key in worksheet 2 and move the data in column B of worksheet 2 into column B of worksheet 1.
I have never programmed a macro so I am completely lost for writing this code.
There is no need for VBA here, Philip.
Try this formula in cell B1 of Sheet1:
=IFERROR(vlookup(A1,Sheet2!A:B,2,false),"")
If you are on XL 2003, then do this:
=IF(ISERROR(vlookup(A1,Sheet2!A:B,2,false)),"",vlookup(A1,Sheet2!A:B,2,false))
Then drag this formula down for the rest of your data in Column A of Sheet1.
NB - Sheet2 is the assumed name of your Worksheet2, you may need to change to fit your needs.
NB2 - you can lookup vlookup in Excel Help (or online) to better understand what it does
Are you sure you need to use a macro for this? It sounds to me like you are using Excel and a simple VLOOKUP formula would do what you need.
A VLOOKUP looks like this: =VLOOKUP(A1,Sheet2!$A:$B,2,FALSE)
Where A1 is your reference cell (in this case you "key" in column A).
Sheet2!$A:$B is the lookup table (in this case columns A and B from the second sheet).
2 is the column number that you want data from, counting from the left (in this case the second column, column B)
FALSE tells the formula to only return values for exact matches. TRUE returns the closest match in the lookup table.