Comparing Staggered Dates [duplicate] - excel

This question already has answers here:
Comparing two columns, and returning a specific adjacent cell in Excel
(4 answers)
Closed 4 years ago.
I have two small tables: one of values that the stock market returned, and the other of the values my trades returned (All of the data is made up).
As you can see, there was not a trade on every day. I am trying to create a table like the third one seen that matches the date in column F to the date in column C and returns the corresponding return. Basically I want to return the second table into the third.
I have tried to use the FIND, CELL, INDEX, etc., but as I am pretty new to Excel, I am not sure I am using them quite right.

in cell H3 of your example, enter formula:
=VLOOKUP(F3,$C$3:$D$11,2,FALSE)
...and the copy or "fill" that formula down to the end of your data (H7).
Note that this will return an error if the date does not exist in the target range.
You can suppress the error by instead using:
=IFERROR(VLOOKUP(F3,$C$3:$D$11,2,FALSE),"")
More Information:
Office.com : VLOOKUP Function (with video tutorial)
Office.com : IFERROR Function (Excel)
mbaExcel : Tutorial: How to Decide Which Excel Lookup Formula to Use

Related

VBA equivalent to an index small function

Hi I have used this formula many times in excel but would like to be able to make a VBA code for it. Based off the criteria in a column "L" I would like to find the 1st and 2nd matches of name in a separate column G and add and subtract the corresponding values associated to that name (on the same rows) in different columns.
Formula: =IF(L3="1:1",INDEX($D$3:$D$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),1))-INDEX($E$3:$E$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),1))-INDEX($F$3:$F$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),1))-INDEX($I$3:$I$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),1)),IF(L3="2:2",INDEX($D$3:$D$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),1))+INDEX($D$3:$D$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),2))-INDEX($E$3:$E$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),1))-INDEX($F$3:$F$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),1))-INDEX($I$3:$I$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),1)),"")
There may be a different way in VBA, this was working in the worksheet so far but got really long based of all the different criteria that could come up in column "L". My data set is about 4000 lines long with many different combinations
My data is as follows: and the expected answers are in column M using the above formula.

Converting table into different Format in excel [duplicate]

This question already has answers here:
How to make a kind of pivot with strings?
(2 answers)
Closed 1 year ago.
I have data in the format shown in the first image with thousands of rows and different attributes. I would like for the data to be changed to a format in the 2nd image which would be easier to use and analyze. Are there any useful functions that could help me achieve this?
I would recommend you to do the following (it is not easy as applying some function, but it works haha). My Excel is in Portuguese, but I hope the images help you.
Copy the first column to another worksheet
Delete duplicates
Insert a new line before the first line on the new worksheet
Copy the second column of the original worksheet and paste it transposed - right click, transposed. Remember to just copy once each value. For example, in your case, just copy Name, Age, Height and Weight.
Finally, it is possible to add a line to represent header for your original data. For example, the first column you can call ID, the second you call Attribute and the third, Value. Then, you filter the colum Attribute by the first possibility - Name, in your case - and copy the column Value to the respective column on new worksheet. Then you filter by Attribute = Age and do the same. Do the same for all possibilities.
So, on the last step, the number of copy-paste is exactly the number of different values you have for your second column.
It is possible to do a VBA code to automate it, if you are going to do it frequently.
#1. You can try to use distinct Formula to get your data index (column A)
or Use Remove Duplicate icon at Excel Ribbon.
A2:A10 is the source list.
B1 is the cell above the first cell of the distinct list.
#2. Create Uniq Row (see my screencapture).
#3. You can use vlookup formula to match your data from sheet1 to sheet2.

Excel, combining two sheets on a third sheet by matching names [duplicate]

This question already has an answer here:
Lookup a value that matches a key in one column then apply that as a key to return a value from a third column
(1 answer)
Closed 4 years ago.
I am working on creating a database of information based on 2 spreadsheet. What is in common about them is that they have the names of people. However, not everyone has data/information for all the other columns. Is there a way to write a formula or code it so that I can get information to populate in a third sheet to say if the names are the same put this information here? I've put an example below. sheet 1 is name and location, sheet two is name is number, and sheet three is what I would like it to look like as an end product.
picture of what im going for
As the comment above mentions, you can use VLOOKUP (or INDEX/MATCH) for this. I would also wrap the entire statment in an IF and ISERROR so if there isn't a match it will return a empty string.
Something like this:
IF(ISERROR(VLOOKUP(G4,$D$2:$E$3,2,FALSE)),"",VLOOKUP(G4,$D$2:$E$3,2,FALSE))
Assume col A:B is your location table, D:E is your Number table, and G:I is the combined table where you put your VLOOKUPs
See this image for example

Excel look up and copy over [duplicate]

This question already has answers here:
Comparing two columns, and returning a specific adjacent cell in Excel
(4 answers)
Closed 8 years ago.
I have two excel spreadsheets. One is a list of our products(spreadsheet 1) with details, the other is a list of products but with empty fields (spreadsheet 2).
I want to lookup a cell (A1) in spread sheet 2 - find the corresponding value in a row in spreadsheet 1 and then get another cell on the same row and copy it over to the spreadsheet 2.
so search for a value "cars" in one spreadsheet and read off its the number plate in the other spreadsheet.
Is this possible in excel ? I have 1555 rows to lookup and read off for a range of values, i can copy both into one spreadsheet but 2 worksheets
Try VLOOKUP()
It does not matter if Your work is in two sheets of the same workbook or two separate excel files.
You use it like this:
You put this formula in the empty cells in the second file
=VLOOKUP(KEY, TABLE_RANGE, COLUMN_INDEX, 0)
KEY is in your example the cell were "car" value is in the second file
TABLE_RANGE is area containing both: KEY equivalent in original data and result You want to copy over. IMPORTANT! first column of range have to be the one that contains KEY values. Also remember to use absolute references ($A$1:$C$55 for example)
COLUMN_INDEX is number indicating column in selected range that You want to use as result
In Your example last parameter have to be 0 (it indicates if Your want exact result or not - it is useful to put 1 in there when You are looking not for exact values but ranges of values)
Than You copy over the formula for all rows You want.
Take a look at this image to visualize how it works and how formula should be used:
(source: microsofttraining.net)

Excel 2010/2013 SUMIFS formula with Table references, Named cells, and Year ranges?

I have a Table in Excel that contains yearly usage data for some products. For example, I have Product A with usage stats from 2003 to 2014. The table is referenced via several Named ranges to be used in formulas. Usage_Product is the column name of the products, Usage_Year is the Year, and Usage_Grand_Total is the total for all months in that year.
I have a basic data chart built using formulas that key off of a Named cell reference called YearSelected. The cell contains a list of years, allowing the user to select the Year they want to see usage for. The following formula works fine when the year is selected:
=SUMIFS(Usage_Grand_Total,Usage_Product,A3,Usage_Year,YearSelected)
A3 is a reference to a cell that contains the specific product name that matches the Table data.
However, I would like to get a sum that includes all prior years instead of just the one selected. I tried the following formula (and variations of it) without success:
=SUMIFS(Usage_Grand_Total,Usage_Product,A3,Usage_Year,"<"&YearSelected)
This returns 0 for some reason. Even if I do "<"&2014 or "<2014", I get the same 0. I do a lot of similar types of formulas, but this one has me stumped. The basic goal is to have a running summary of usage for the start of each selected year. Any ideas on using the right formula option?

Resources