In the sheet1 i have a table called working days of the countries as shown in the below image.
In the Sheet2 i have 10 columns in that based on the country and month by referring the this table i am trying to populate the values, When i tried doing by Vlookup the first row alone getting populated, but in the second row the header from F1:T1 is getting changed to F2:T2 so rest of the cells showing as #NA.
Anyone can you please give a solution for my issue. Here is the formula i have used.
=VLOOKUP(I1,Sheet1!F2:T7,MATCH(Sheet2!M1,Sheet1!F1:T1,0))
Thanks in Advance.
You are missing the symbol $ to lock the ranges, and the false condition to match exact values in the VLOOKUP.
It should be like:
=VLOOKUP(I1,Sheet1!$F$2:$T$7,MATCH(M1,Sheet1!$F$1:$T$1,0),0)
Or instead of VLOOKUP use HLOOKUP like:
=HLOOKUP(M1,Sheet1!$F$1:$T$7,MATCH(I1,Sheet1!$F$2:$F$7,0),0)
In general, combining the INDEX and MATCH functions is a superior option to VLOOKUP. For example, =INDEX(Sheet1!F:F,MATCH(Sheet2!M1,Sheet1!F1:T1,0)). This allows you to go left-to-right or right-to-left as well.
Snip for Index Match functions Using Vlookup won't work here because in the 2nd table you are repeating the country, unlike the first table. Use a combination of index match function, this is little trickier than the vlookup but it will fulfill your requirements.
Since I don't have the exact table you shared so I created a table on my end and sharing the snip here.
Related
Basically I have a table like this:
The Names are filtered from another table and are dynamic.
I am trying to sum the values based on two criteria ("Duration" and "Day of week"), like this:
=SUMIFS($B5:$E5,$B$2:$E$2,G$2,$B$3:$E$3,G$3)
This gives a correct result, but I want the formula to dynamically update, based on the dynamic formula that contains the names. So I tried this:
=IF(A5#<>0,SUMIFS($B5:$E5,$B$2:$E$2,G$2,$B$3:$E$3,G$3),0)
This goes way down the table, but it always returns the sum of the first row.
Is anyone aware of a solution to this?
Just posting an answer so I can include a screenshot - illustrating that the formula
=SUM(INDEX($A$5#,,MATCH(G2&G3,$A$2:$E$2&$A$3:$E$3,0)))
does produce a valid result
I'm looking to use the filter formula on a named range but there hasn't been a resource that has explicitly showed how to reference columns within a named range. I might add that the whole named range includes the headers due to the nature of the original data. It has 13 Columns.
The columns I want with their position is: "Injury Date" (6) and "INCURRED" (8)
=filter(Loss_Run,[Insert Chosen Columns Here])
This is the syntax I am trying to use but I cannot get it to work. I am not sure how to tell it to use the columns I want. Do I use the name of the columns or the number either way is fine to me.
I am trying to filter by a specfic value of a row and that is where the main hiccup is.
I got
=FILTER(Loss_Run,(Loss_Columns="Injury Date")+(Loss_Columns="INCURRED"))
to work.
BUT,
I want to first filter the first column, "ULGTACCT Code" (1) by a value (that is in cell A2 for our purposes). It is not allowing me to filter by the first column with or with out the other columns
What I have found says:
=FILTER(Loss_Run,(ULGTACCT Code=$A$2),"")
should work but I get #Name? error.
To answer about calling a column within a table with name ranges and the FILTER function is things are much smoother if you specify columns as =FILTER(TableName[ColumnName],include"argument") within brackets "[ ]", this means that your table will need to be named to make this easier. That's how you would call a specific column.
To the other point of specifying the columns to FILTER, I have only found that to do this you write it as =FILTER(TableName[#[ComlumnName1]:[ColumnName4]],include"argument") and that should do it but I get an #Value error doing that.
I'm looking for any help as well with this so if this helps to bring you to a answer please share.
I was using
=FILTER(TableName, (TableName[Column]="SearchValue")
And I got all table rows back that were matching the criteria.
I am trying to lookup a value from another table based on a reference table.
See below my data sample:
SHEET 1 ("CalculationLiability"):
SHEET 2 ("KeyMetrics"):
In sheet 1, cell G7 I am trying to look up the value from Sheet 2 based on 3 criteria (supplier unique ID, type and season) I tried the following formula, but it is returning a #REF error.
=INDEX(KeyMetrics!$F$6:$AS$100,
SUMPRODUCT((KeyMetrics!$D$6:$D$39=CalculationLiability!$D7)*
(KeyMetrics!$E$6:$E$39=CalculationLiability!$G$6)*
(KeyMetrics!$F$5:$AS$5=CalculationLiability!$E7)))
Anyone knows what I am doing wrong here? I can get it to work for two criteria, but for three criteria it doesn't work. Any help or push into the right direction is much appreciated!
The Index uses a multi column, multi row reference. That means that you need two additional arguments, one argument for row, and another for column.
Your formula currently only provides one additional argument. When you step through the formula with the Evaluate Formula tool you can see that in the last step.
You can use an Index with two Match functions. The first one to find the row, the second one to find the column.
=INDEX(KeyMetrics!$F$6:$AS$100,
MATCH($D7&$G$6,INDEX(KeyMetrics!$D$6:$D$100&KeyMetrics!$E$6:$E$100,0),0),
MATCH(CalculationLiability!E7,KeyMetrics!$F$5:$AS$5))
You can also use Sumproduct, but in that case, don't use Index.
=SUMPRODUCT(KeyMetrics!$F$6:$AS$39,
(KeyMetrics!$D$6:$D$39=CalculationLiability!$D7)*
(KeyMetrics!$E$6:$E$39=CalculationLiability!$G$6)*
(KeyMetrics!$F$5:$AS$5=CalculationLiability!$E7))
I'm having a very difficult time with transitioning my VLOOKUP statement from simply referencing sheets and ranges (which work like a charm), to instead using table and column names.
I'm trying to make the VLOOKUP a bit more robust as the sheet where it is pulling from will constantly be changing data, so column numbers will change frequently. Thus, I'd like to just reference a column by its name.
I have converted the source data sheet to a table.
I have named all columns appropriately and double checked spelling.
This VLOOKUP works great (currently):
=VLOOKUP(E6,'Costs'!$A$2:$AE$84,19,FALSE)
However, what I would like to do is make it look this:
=VLOOKUP(E6,tblCosts[Order Number],tblCosts[June 2017], FALSE)
I have been fiddling with also trying to use MATCH which is not working either:
=VLOOKUP(E31,tblCosts[Order Number],MATCH(F4,tblCosts[June 2017],FALSE),FALSE)
UPDATE
This formula now works but it is returning the order number...not the cost for the month.
=VLOOKUP(E31,(tblCosts[Order Number]),(tblCosts[June 2017]),FALSE)
Normally I would keep trying this myself...but I am feeling overwhelmed and have been trying for hours. Any advice would be great.
Thank you!!
This should work for you:
=VLOOKUP(E31,tblCosts[#All],COLUMN(tblCosts[Jun-17]),false)
The COLUMN(TblCosts[Jun-17]) returns the column number of the field you want.
The VLookup searches the first column of tblCosts[#All] - (all the data in the table) for the data (in E31) and returns the data in the column you want.
This formula will continue to work even if you add columns or rows to the data.
Make sure that any heading which looks like a date in your spreadsheet eg "Jun-17" is stored as Text and not as a Date, as it will not match the string "Jun-17" when you use VLookup.
=VLOOKUP(E37,tblCosts[#All],match("Jun-17", tblCosts[#Headers]),FALSE)
This match is looking for the column name in all column headers and will return the number of columns to the right of the first column rather than the column number in the sheet. This avoids having to use COLUMN(tblCosts[Jun-17]) - COLUMN(tblCosts[Order Number]) + 1 when your table doesn't start in column A.
Ref: https://www.excel-university.com/vlookup-hack-4-column-labels/
The vlookup function appears to be broken. It is returning the same value for all lookups, but it should not.
I have it set like so:
=VLOOKUP(A3, Asset_Mapping!A$2:B$673, 1)
Where the lookup value is in the B column and the result is in the A column.
I use the $ so the rows are not auto-updated to A3:B674 etc as I paste the formula down the rows. However, even if I manually enter that formula into the next row, it is not finding the correct value.
IF i remove the "$", the correct values are found for the first rows where the values fall within the modified range (e.g. Asset_Mapping!A3:B674) but eventually as expected it stops finding the values as the range is invalid.
What am I doing incorrectly here? I have formulas set to auto-calculate.
Without testing on your actual data it's hard to confirm this will work but add the false parameter. This will find exact matches and not the first partial match.
=VLOOKUP(A3, Asset_Mapping!A$2:B$673, 1, false)
Collating the points together and clarifying the formula
Parameter 1: The value you are looking for
Parameter 2: The table with the data. First column is the value you are looking for.
Parameter 3: The column number of the value you want to show.
Parameter 4: If you want an exact match or partial match.
#Jeeped made the point of ordering data to get more reliable results. Good advice.
Andres has the right idea, but there is a faster way to fix the problem.
If it is returning the same value over and over again for your whole range, you probably have your Calculation Options set to "Manual".
Go into Formulas on the top ribbon and choose Calculation Options. There, you can change your calc method to "Automatic".
Also lookup value must be in first column.
Where the lookup value is in the B column and the result is in the A column.
VLOOKUP always lookup in the left-most column and returns a value from the column number specified. If you want to reverse the lookup/return order then use INDEX(..., MATCH(...))
=INDEX(Asset_Mapping!A$2:A$673, MATCH(A3, Asset_Mapping!B$2:B$673, 0))
Note that you were using a sorted, binary lookup; I've changed this to an exact match lookup which does not require sorted data.
Just in case adding a solution to this topic.
Don't know why in big tables Vlookup and Index+Match tend to show just the value of the first result in all the other cells.
In my case to fix this, after I've copied the formula in the whole range, I choose any cell containing it, press F2 and then Enter. It kind of forces excel to process everything.
I've been working on this for a week with no results. I've created this same spreadsheet for another apartment community without any issues, but for some reason, I cannot get the proper results in this spreadsheet. I've tried vlookup as well, but that didn't help either. any more advice?
Formula
Result and lookup vectors