excel vlookup in tables - search for row and report value in column using column name - excel

I have a database table that is structured like this
SAP Number, FOW, WD, DG
In a different sheet I am using data from this list
It looks like this
SAP Number, WD, DG, ....
The SAP Number is given, WD and DG are searched using VLOOKUP
=VLOOKUP($A2,Objektive!$B:$M,10,FALSE)
This however is difficult to read and could be solved much easier.
I know that the search value is in $A2, and I know that the value is in a tabular named "WD".
Is it possible within Excel to search for the Row similar ot VLOOKUP, but use the column using the column name as [#[WD]]
Here some peudo-code
=VLOOKUPTABLE($A2,Data[#[WD]],FALSE)

If your data table starts from the first column, you can use the COLUMN function to determine the index of the column you want to return data from in the table using the name of that column.
=VLOOKUP($A2,Data,COLUMN(Data[WD]),FALSE)
Alternatively you can use Index/Match to directly reference the columns you want to match and return data from.
=INDEX(Data[WD], MATCH($A2, Data[SAP Number], 0))

If you create a table from the Excel (select any of the cells and press Ctrl + T) you gain access to named references which you can use in Excel formulas. Just make sure your data contains headers.

Related

Determine sequence of most used words in Excel data set

I need to determine sequence of most occurring word in a excel data set. Eg.
A B C D
Joyce Bremner Lewis Chapman Claire Harper
Lesley Brown Brian Clough Natalie Hassan
Emma Cartwright Janet Coldwell Gillian Hedley
Lewis Chapman Sheena Doig Lesley Brown
Brian Clough Karen German Emma Cartwright
Janet Coldwell James Gledhill Lewis Chapman
Sheena Doig Maggie Gowan Brian Clough
Which name is the most occurring and then 2nd most occurring word and so on.
I have found solution for determining the most concurring word in sequence when you take only one column into consideration but struggling to combine for multiple column. Below is the formula used:
Enter this array formula in C2:
=IFERROR(INDEX(A2:A10,MODE(MATCH(A2:A10,A2:A10,0)+{0,0})),"")
Enter this array formula in C3 and copy down until you get blanks:
=IFERROR(INDEX(A$2:A$10,MODE(IF(COUNTIF(C$2:C2,A$2:A$10)=0,MATCH(A$2:A$10,A$2:A$10,0)+{0,0}))),"")
Just in case the single column and pivot are a feasible idea...
Put all the names in one column
Format as table (my pref.)
Select "Summarize as pivot table"
Add "Name" field to Rows and Values

Why does this VLOOKUP result in an #N/A error?

Here is a simplified version. I was trying to match the shop grade from a given table to the data but it returned error, what's wrong with my vlookup function? I'm an Excel beginner.
The data:
The given table:
You are trying to match Column B so your lookup range should start with that:
=VLOOKUP(B2,Table!B2:C3,2,False)
Vlookup requires the first column to be the lookup column.
You have to look up by referencing the first column in the table. In this case, change B2 to A2 and it will work.
What is vlookup?
Does a lookup for a specified value in the left most column of a specified table(table_array) vertically from top to bottom and returns a value from one of the columns(column_index_number) of the table. Formula follows
VLOOKUP(lookup_value,table_array,column_index_number,[range_lookup])
These are common pitfalls with vlookup.
If table A is used to lookup and table B is getting populated with values
Lookup value is not first column of table array(table A)
Lookup column on table array is not sorted - sort using excel sort function in Data tab
Dragging the formula would have caused Table array to shift for each lookup in table B. E.g A1:C10 may become A2:C11 for second lookup and can result in #NA if lookup result falls in top rows which is missing. Use $A$1:$C$10 as lookup array table A to make sure that formula is not affected while dragging the cells. Alternately, naming table array can also be employed.
Range lookup true can result in getting invalid results even when no result is present in table A. Using range lookup false will be accurate in most cases.
Reference :
MS Office vlookup help
Named tables in Excel

Excel - Check if value X and value Y is on the same row

I have an excel document with two sheets, data and edu-plan. The sheet data has the following information:
The sheet edu-plan looks like this:
My question is: how do i create an excel formula that checks if the target group on the specific row in edu-plan! has the course name in question on the same row as the target group in sheet data!, i.e. if Sales and Sales course is on the same row in the sheet data!?
In reality, the data sheet as a couple of hundred rows and will change over time, so i am trying to develop a formula that i can apply easily on all rows/columns in edu-plan!.
The desired result in edu-plan would look like this:
A pivot table might be a good way to go.
If you would like to do it by formula, then you can just use a COUNTIFS
=IF(COUNTIFS(data!$A$2:$A$10,$A2,data!$B$2:$B$10,B$1),"X","")
A possible way to solve your issue with an array formula:
Write in B2 of sheet edu-plan
{=IFERROR(IF(MATCH('edu-plan'!$A2&'edu-plan'!B$1,data!$A$2:$A$6&data!$B$2:$B$6,0)>0,"x",""),"")}
Since it is an array formula, you need to hit shift + ctr + enter.
Here is the formula broken down:
MATCH('edu-plan'!$A2&'edu-plan'!B$1,data!$A$2:$A$6&data!$B$2:$B$6,0)
checks whether the combination of row header and column header is in the data table. MATCH returns the index of the found combination. Since we are not interested in the location, we only ask IF(MATCH > 0, "x", "") to write an "x" if a match was found. If MATCH finds nothing, it returns an error, which is why we add an IFERROR(VALUE, "") around the construct.

VLOOKUP with criterion in range

I have a table A that contains ID (i.e. SR1000). Also a table B with two rows, another ID (i.e. C-1) and text on the second row.
I was trying to use VLOOKUP using the ID on table A to return ID on Table B if ID from Table A is somewhere in the text of column 2 in table B.
Table A
SR1000
SR1001
Table B
C-1|dummy text
C-2|dummy SR1000 dummy
So it should return C-2 when looking for SR1000.
Is VBA my only option? Trying to avoid reinventing the wheel.
It seems the formula:
=INDEX(F:F,MATCH("*"&B4&"*",G:G,0))
has been deemed fit for purpose and by way of explanation this was based on assumed locations as below:

Autofill column of an Excel table based on another column

I've created a table with multiple columns in Excel, and I'm trying to let it autocomplete some columns based on another one: There's an "Item name" column and a "Item type" one, and I want to make excel autofill the Item Type field on every row based on the entry in the Item name field on the same row, is there a way to make Excel handle this by itself based on previous entries?
EDIT: Example for clarity:
If I insert "Pizza" in Item Name and "Food" in Item type, when I enter "Pizza" again in another row, Excel auto-fills the same row "Item type" field with "Food"
Based on your edit you want the vlookup function.
VLOOKUP( value, table, index_number, [not_exact_match] )
If index_number is less than 1, the VLOOKUP function will return
VALUE!. If index_number is greater than the number of columns in table, the VLOOKUP function will return #REF!. If you specify FALSE
for the not_exact_match parameter and no exact match is found, then
the VLOOKUP function will return #N/A.
But first you'll need to make sure that these associations are already present. You need a table like this. Assume that 'object' is a1 and 'type' is b1:
Object Type
Pizza Food
Car Vehicle
Now for your table that you're entering the values, assume that 'name' is d1 and 'type' is e1:
Name Type
Pizza =vlookup($d2, $a$2:$b$99, 2, false)
Car =vlookup($d3, $a$2:$b$99, 2, false)
The '$' will prevent the relevant cells from changing if you use autofill to complete the column.
If this is a set list that is relatively short you can manually enter it into the autfill options.
Microsoft gives you all the various ways to do this.
https://support.office.microsoft.com/en-us/article/Fill-data-automatically-in-worksheet-cells-74e31bdd-d993-45da-aa82-35a236c5b5db?CorrelationId=99c7dec0-4c5c-4988-b148-6d3b7c4dd2e5&ui=en-US&rs=en-US&ad=US
Also, creating a pivot table may be what you want to do. Simply highlight your main table and go to the insert table and click pivot table. Move the headers into the appropriate box.
The last option may be your best bet if it involces a ton of values. lookup/match functions will give you a more robust formula that is more versatile.
If you can give a sample set of data and what you want it to look like I can give you the formula.

Resources