Automatically update the file path of Vlookup to the newest workbook added to a folder - excel

Hello each month we receive a series of monthly returns from different accounts which go into a designated folder based on the account name. Each return has the new month's returns appended to all the previous monthly returns. I am running a vlookup function on my workbook based on the specific return I am looking for. Is it possible to change the source on the vlookup function so it takes the data from the most recently added file in the folder, that way it will contain all the most recent return data with all the previous returns?
Thanks

There are many ways to do that. The first step should be to connect to the designated folder. You should see then something like this:
Option 1: If the file contains the month
If your file contains the month you can use it to extract this information. Following the example above you could:
extract the first 7 charactes and parse it to a date.
sort the date in descending order, so the latest file will be on top
use keep rows to get rid of the rest of files
with the last file remaining, expand the content
Option 2: Use file properties
When you connect to a folder you can see the field "Date created". Use this the same way as explained in option 1.
Option 3: Remove duplicates
If for whatever reason the two options above are not possible, depending on your data you can:
join all files which will lead to duplicates
filter duplicates
This third option might not work if you could have two registers which look the same (all columns in the row have the same value) can appear in your dataset.

Related

How to grep csv documents to APPEND info and keep the old data intact?

I have huge_database.csv like this:
name,phone,email,check_result,favourite_fruit
sam,64654664,sam#example.com,,
sam2,64654664,sam2#example.com,,
sam3,64654664,sam3#example.com,,
[...]
===============================================
then I have 3 email lists:
good_emails.txt
bad_emails.txt
likes_banana.txt
the contents of which are:
good_emails.txt:
sam#example.com
sam3#example.com
bad_emails.txt:
sam2#example.com
likes_banana.txt:
sam#example.com
sam2#example.com
===============================================
I want to do some grep, so that at the end the output will be like this:
sam,64654664,sam#example.com,y,banana
sam2,64654664,sam2#example.com,n,banana
sam3,64654664,sam3#example.com,y,
I don't mind doing it in multiple steps manually and, perhaps, in some complex algorithm such as copy pasting to multple files. What matters to me is the reliability, and most importantly the ability to process very LARGE csv files with more than 1M lines.
What must also be noted is the lists that I will "grep" to add data to some of the columns will most of the times affect at most 20% of the total csv file rows, meaning the remaining 80% must be intact and if possible not even displace from their current order.
I would also like to note that I will be using a software called EmEditor rather than spreadsheet softwares like Excel due to the speed of it and the fact that Excel simply cannot process large csv files.
How can this be done?
Will appreciate any help.
Thanks.
Googling, trial and error, grabbing my head from frustration.
Filter all good emails with Filter. Open Advanced Filter. Next to the Add button is Add Linked File. Add the good_emails.txt file, set to the email column, and click Filter. Now only records with good emails are shown.
Select column 4 and type y. Now do the same for bad emails and change the column to n. Follow the same steps and change the last column values to the correct string.

Excel - compare dates in multiple files and retrieve the latest date

I'm working in an Excel file that has gotten corrupted values - so I need to look at older backup files, and there are a lot of files.
In the main file I have column A that can be matched in any of the files, then I need to look at column B:C and retrieve the date that is closest to today - if it holds a date.
Sorry if this is unclear. Just ask if you have any question!
EDIT: The top left window is that I want to retrieve from the three other files.
I have multiple columns and need the dates to be checked separately, then get the date that is closest to today.

Excel Concatenate a string in multiple columns, count and remove the duplicates

Currently the stock process at my company is very manual and it normally doesn't get carried out due to the process being rather boring. Currently all excel based I am slowly moving over to SQL that will automatically update the information.
We have come up with a naming system/code for each item, this is made up from several fields on the excel document. However there is the same codes in different columns that we wish to remove for when we push into SQL (Basically we just want the 1 line item and a count of how many times it has been used)
It has to be dynamic. (I can add an extra tab to the excel document to do any magic required) and if possible not use any Macros
So the data starts like this:
#Counts and then the duplicates are removed to produce this list
I have tried a range of countifs/Vlookups and I can get it roughly working but its not dynamic enough and I end up having multiple rows of 0 Qtys
Hopefully this is enough information
Cheers all
It looks like a very similar question was answered here.
After plugging in that formula in a different column, you can use the CountIf function in the next column.

How do I compare two spreadsheets to identify missing line items and add them?

I am trying to compare two .xlsx files. What I am looking to do is basically the following:
Does any cell in column B of file1 exist in column B of file2?
If yes, continue.
Else, add the row to file2
The structure of the files is different, so I would need to organize the information being added to file2 to match the format, also, but I think I would be able to do that myself once I know how to do the transfer.
The files are basically a vulnerability export from ACAS and a POA&M. I want to add any existing vulnerabilities from the export that are not already represented on the POA&M.

Excel Lookup with multiple queries

I have a question that I a may not be thinking correctly about. But I have an a long excel file that I pull from somewhere else with the following columns:
Project_Name1, Employee_Name1, Date_Worked1, Hours_Worked1
In another sheet I have these columns
Project_Name2, Employee_Name2, Begin_Date2, End_Date2, Hours_Worked2
This second sheet is filled with data, and works just fine.
However, it turns out that I have some employee names that I do not know that are also working on the same project. I need to figure out the names of the employees and then sum the number of hours they worked for a given period.
So I need a lookup with three criteria:
Project_Name1 = Project_Name2
Employee_Name1 <> {Array of Employee_Name2}
Begin_Date2 <= Date_Worked1 > End_Date2
Returning Employee name.
Once I have the employee name, I can do a sumifs=() and get the total hours they worked no problem.
I have tried a number of combinations of Index Match functions, using ctrl-shift-enter... and have not been able to figure out it. Any help would be greatly appreciated.
What you're talking about doing is extremely complicated and a little bit past what Excel was designed to do by default. However, there are a few workarounds that you can use to attempt to get the information that you're looking for.
It's possible to do multiple-criteria VLOOKUPs and SUMIFs by concatenating fields to make a multi-part identifier (Ex: Insert a new column and have a forumla in it like =A1&B1)
Open a new workbook and use Microsoft Query (I'm not sure if you can select from more than one sheet, but if you can select from multiple sheets like tables you should be able to write a semi-complex query to pull the dataset you want.
http://office.microsoft.com/en-us/excel-help/use-microsoft-query-to-retrieve-external-data-HA010099664.aspx
Use the embedded macro feature and use visual basic script to write out your business logic. (Hotkey is ALT+F11)
One way to do this would be to first create an additional column to the right of entries on the sheet you're trying to pull employee_name from: =ROW()
You could then use an array formula like you were trying to implement to pull the corresponding 'match' row:
{=SUM((project_name1=projectname2)*(employeename1<>employeename2)*(begindate<=date_worked1)*(date_worked1>end_date2)*(match_column))}
You could then use this returned match_column entry within the index as you described to retrieve the appropriate entries.

Resources