excel - advanced vlookup or other formula? - excel

I have a question regarding excel and I am looking for a formula that can help me transport my data from one sheet to the other. I have some experience with excel, however I am not a pro at it, so I apologize if this is a very trivial question but would also be happy since that would mean it probably has a very trivial answer! Unfortunately I do not have enough reputation points yet to post images, but I will try to explain it as clearly as possible.
Basically I am creating an excel template and the goal is to have 2 sheets in excel.
In the first sheet I have a column with following input in rows A1 - A3: Sales Region,
Country, Account ID's.
Above is the example of column A; from column B --> x; I will put e.g.
Americas, US and as many account numbers as there are in that specific country.
However on the second sheet it gets a bit complicated. My goal is that all the account numbers from sheet 1 irrespective of their sales region and country (which also means irrespective of their column) will automatically be listed on the second sheet.
The second sheet will be organized in the following way:
From column A - C; sales region, country and account ID.; from column D - x financial information for each account.
As a first step I want all the different account ID's from the different columns on the first sheet to be listed under column C (account ID's) on the seconds sheet.
As a second step I want column A - B to be automatically filled out according to account number by accessing the information in which column and thus sales region and country the account is in on sheet one.
I don't think a simple vlookup would do the job, especially for step 1, since I want the account ID's from many different columns and rows in sheet 1 to be listed in just one column....
hope it is clear enough! Would appreciate any help! :) thanks in advance!

The first step take all of column A and copy it to the 2nd sheet on column C.
Select data ribbon and select remove duplicates.
For column A insert vlookup for column C for all the data in 1st sheet
For column B insert vlookup for column B for all the data in 1st sheet
Those value will work well only if an ID has one valid Region and country.
Now just use custom sort to sort it in the way you desire.

Related

amounts and ageing in excel

I have two excel files that I need to cross reference amounts in.
The first sheet looks like the below:
what I need to do is find any amount that are contained on sheet 2 and the month they fall into.
Sheet 2 looks like below:
for example on sheet 1 I have 56.49 in column C for reference AK1080117 in column A and this shows as Person 8 on sheet 2.
I can see this is correct as on sheet one it has a transaction date of 08-jan and on sheet 2 is in the column JAN.
There is no same ref that can be used between sheet 1 and 2 as sheet 1 has Reference and sheet 2 has Name.
Can anyone advise the best way to do this.
The complete sheets are hundreds of lines long.
Many thanks,
Note: Make sure your data has unique values AND it is not exceding the year 2017
If so, I have found a way to maybe do this in a few steps:
1: Add another column E to your first sheet and add this formula to second row of the column and drag it all the way down:
=SUBSTITUTE(ADDRESS(1,MONTH(B2)+1,4),"1","")
2: Now create another column F next to the freshly made one and put this formula in second row:
=MATCH(C2;INDIRECT("Sheet2!"&E2&":"&E2);0)
3: Now create a third column G and put this formula in second row to be dragged down:
=INDEX(Sheet2!A1:D15;F2;1)
4: Now you have created a cross-reference because column G will show you the person with a match.
Edit: You can combine the three formulas direclty obviously but my personal preference is to brake things down to make them easier to understand :)
=INDEX(Sheet2!A1:D15;MATCH(C2;INDIRECT("Sheet2!"&SUBSTITUTE(ADDRESS(1,MONTH(B2)+1,4),"1","")&":"&SUBSTITUTE(ADDRESS(1,MONTH(B2)+1,4),"1",""));0);1)
Good luck with it!
You need a third table that has Reference and Name. Then you can use lookup functions or table relationships to link the data together.
Ask the source of the first table to include Name as a field.

Excel- Find matching values then compare additional respective values

I have been struggling with creating a complex formula to accomplish the following:
I am using 2 sheets of data within a workbook. I want to first find exact account number matches between the two sheets. (ie. On sheet two there are specific accounts I want to find in sheet 1- which holds all account numbers) I think I accomplished this with formula =COUNTIF('Sheet 2"!$A:$A,F1)>0 [account numbers are in column "f" in sheet 1] - they are all currently highlighted in sheet 1.
I now want to take those matches and compare the respective values listed in each separate sheet. (ie. I have now found all the accounts I need in sheet 1. Lets say account ABC is one account of interest. ABC's value is in column B of sheet 2. I want to compare the value I have listed in column C of sheet 1 to see if it is < or =.
I am not that advanced in excel formulas; you all are way smarter than I, so hoping you can help!
Thanks in advance

Cross Referencing Data in Excel

I am trying to start an advertisement analytics tool for my business. I have an Excel spreadsheet with 3 Sheets. Sheet 1 contains data about the advert clickers, Sheet 2 contains information about the product buyers and Sheet 3 should collect data based on cross-referencing data between Sheets 1 & 2.
The columns in Sheet 1 are as follows:
A B C D E F G
------------------------------------------------------------------------------------
product type, tag, click date/time, IP address, expiry time (days), expiry date/time
Each row represents a click. The expiry time (days) is determined by the product type, and the expiry time/date is the expiry time (days) added to the click date/time. The tag is a code that tells me where the link was found by the clicker.
The columns in Sheet 2 are as follows:
A B C
---------------------------------------------
product type, IP address, purchase date/time.
Each row represents a product sale.
There are more rows in Sheet 2 than there are in Sheet 1.
There are three pieces of information that I want to match between Sheet 1 and Sheet 2: IP address, product type and whether the purchase date/time (Sheet 2) falls between the click date/time and the expiry date/time. I have made formulas that can verify whether this occurs but only for assigned cells in each Sheet.
I am trying to get Excel to match one row from Sheet 1 to all rows in Sheet 2. As there are more rows in Sheet 2 than in Sheet 1, there could be multiple matches for each tag as defined in Sheet 1, as customers may decide to buy more than one product after clicking the link.
Is there a way to try and match the data between the two Sheets and then collect the number of matches in Sheet 3? It may be easier to achieve if the IP address and product type are matched first and then to try and see if the purchase date/time falls within the click date/time and the expiry date/time.
Any help on this would be greatly appreciated and thanks so much in advance. This has been bugging me for a while and I can't figure it out.
I think I have a good start for you. With vlookup you can specify multiple criteria. First start by bringing in the useful data into one sheet - I would take column D and E of "sheet2" and use these:
In D:
=VLOOKUP(A2& " "&B2,Sheet1!$A$2:[BOTTOM RIGHT OF TABLE],3)
The 3 at the end specifies you want to return the click date.
In E:
=VLOOKUP(A2& " "&B2,Sheet1!$A$2:[BOTTOM RIGHT OF TABLE],6)
The 4 at the end specifies you want to retune the expiry date.
Once they are on one sheet, you can do an if statement comparison to see if the date (Column C) falls between your two dates (Column D and E).
Here is the if statement for that:
=IF(AND(C2>=D2,C2<=E2),1,0)
There is one shortfall to this, and that is if there are multiple matches for both product AND ip - this will only return 1, but otherwise you're talking about scripting something in VBA.
In excel you can refer cell based on sheet like this and make it on third sheet:
=Sheet1!A1+Sheet2!A2

EXCEL: Combining SUMIFS with multiple VLOOKUPs due to small variances in names

Ok, this is going to be a difficult question to ask, but I'm gonna give it a try.
I have three sheets (Sheet1, Sheet2, Sheet3) in one worksheet (Worksheet).
Sheet1 contains ~100,000 rows with columns Company (A), Holding (B), Product (C), Year (D), Spend (E).
Sheet2 contains 100 rows with columns Company (A), Holding (B), Product Spend in certain Year (C).
Sheet3 contains 100 rows with columns Company (A), ID (B), Variant1 (C), Variant2 (D), Variant3 (E).
What I want, is in Sheet2 to calculate the Product Spend in certain Year. I've been able to do this as a test in Sheet1 by using the function SUMIFS. So in Sheet1 I used:
=SUMIFS(E:E,A:A,"Fake Ltd",B:B,"Fake Holding",C:C,"Dog Food",D:D,"2011")
The problem is that the company names aren't the same in all sheets. I tried to solve it via a FuzzyFind, but that is not working perfectly enough. So I decided to change my methods, and that's why Sheet3 exists. This sheet contains all different name variants of one company in one row (similar to a relational database).
Now I need to use this SUMIFS function in Sheet2 where the company name relates to all possible other company names in Sheet3 so it can sum the company names that appear in Sheet1 as if it were one company name. The column Company in Sheet3 is the 'chosen' company name and also the one used in Sheet2. It's Sheet1 that gives the problem.
So somehow I need to combine SUMIFS with VLOOKUP in Sheet2, but I am not sure how. Anyone any clues? I'll do my best to improve my question, I can imagine if I didn't do the best job explaining.
Unless Sheet1 is read-only, just add another column to Sheet1 in which you look up the proper company name from Sheet3. Then build your SUMIFS in Sheet2 based on this column.
If you're using Excel 2010/13, consider installing Powerpivot as an alternative. Here you only need to link the table from Sheet1 with the table from Sheet3 via the Company name column - and then produce a pivot that gives you all the aggregations you need!
I think what you're after is excel's array functionality.
http://office.microsoft.com/en-au/excel-help/introducing-array-formulas-in-excel-HA001087290.aspx
For Sheet C, I'd suggest repeating the pattern:
Company, Variant
That way, you can cross reference any and all companies that match in C without trying to compare against offset 1, 2, 3 ... n
You can then combine the results and use that to match against multiple criteria:
http://blog.contextures.com/archives/2012/07/12/check-multiple-criteria-with-excel-index-and-match/
(the criteria is essentially the union of all rows that match both a company name and a year).
Once you've got the array of the rows that match, you can then apply your sumif over the top.

Excel: Multiple Vlookups to pull in 1 data element

I have 2 separate sheets in Excel. On sheet 1, I am using the following if statement in column C (hours) to pull in a number in column D (hours) from sheet 2.
=IF(ISERROR(VLOOKUP(A2,Sheet2!A:D,1,FALSE)),"N/A",VLOOKUP(B2,Sheet2!A:D,4,FALSE))
The first vlookup is validating the project number on the second sheet, then the second vlookup is validating the team name and pulling in the hours from the second sheet.
The problem is that when I copy the formula down the column, the hours value repeats for the same team name. Does anyone have any suggestions?
Sheet 1
columns
Proj_Number Team Name Hours
123456 R&D 26
123456 Dev 50
123456 QA 10
777777 R&D 26
Sheet 2
Proj_Number Team Name Organization Hours
777777 R&D AUTO 26
123456 DEV AUTO 50
123456 QA AUTO 10
123456 R&D AUTO 20
You are asking VLOOKUP to do something that it cannot do. The second VLOOKUP in your IF formula:
VLOOKUP(B2,Sheet2!A:D,4,FALSE)
is being asked to return the first instance of 'Team Name' that it finds on sheet 2; which it is doing.
If you want to return the number of hours based on the 'Team Name' and 'Proj_Number', you need to do it a bit differently.
One way is to create another column on Sheet2, maybe called 'Proj_plus_Team', (inserted at column C location) that concatenates the values in 'Proj_Number' and 'Team Name'. Then you can search on this new column using the following formula:
VLOOKUP(A2 & B2,Sheet2!C:E,3,FALSE)
Also, when doing this, make sure that the data on Sheet2 is sorted alphabetically on the values in column 'Proj_plus_Team'. VLOOKUP requires that the search column be sorted alphabetically or inaccurate results may be returned.
Option 1 - using formulas
LOOKUP is designed to retrieve a single value, which is what it's doing. It loops through a data range, checking whether the value is bigger/smaller than the reference value, and retrieves the first transition point. In your case, it finds the first match and stops, not what you're after at all.
If you want to do this using formulas, you'll probably find SUMIF() and the newly added in 2007 SUMIFS() to be a much cleaner route. Also, side-note, in Excel 2007 Tables are your new best friend, they tidy the formulas for this kind of thing right up and look after things like expanding ranges.
Your example above, using tables, would be translated to:
=SUMIF(Table2[Team],Table1[[#This Row],[Team]],Table2[Hours])
where Table1 is the equivalent of your Sheet1, and Table2 maps to Sheet2
Of course the reason that this won't provide what you're after is that this is summarising by team only, whereas you want to apply 2 filters, so you'd move to SUMIFS() and end up with:
=SUMIFS(Table2[Hours],Table2[Proj_Number],Table1[[#This Row],[Proj_Number]],Table2[Team],Table1[[#This Row],[Team]])
The benefit is that your formula will always recalculate automatically, the downside is that you have to manually update your Table1.
Option 2 - pivot tables
Insert --> Pivot table will create your pivot table, set the range as appropriate.
Then drag Project Number into Row labels, drag Team name below it also in Row labels, and drag Hours into the Values box.
That'll give you a breakdown by project by team of how many hours. You can then mess around with the options to get it exactly how you want, by doing things like turning off the level 1 summaries. Those kind of options are best found by experimentation, they live in the PivotTable Design tab. The catch is the need to manually refresh the pivot table, the benefit is that when you add new projects they'll be taken care of easily.

Resources