+ Reply to Thread
Results 1 to 28 of 28

Lookup value with multiple criteria - Data Range in multiple files

  1. #1
    Forum Contributor
    Join Date
    07-09-2013
    Location
    Nagpur, India
    MS-Off Ver
    Excel 2010 / 2013
    Posts
    293

    Lookup value with multiple criteria - Data Range in multiple files

    Hello, My data is divided in 3 workbooks i.e. Data1.xls , Data2.xls & Data3.xls saved in folder "D:\SalesTrendReport" .
    I needed to get Sales qty data from these 3 files to my workbook 'Sales Trend.xlsx' based on Office Code & Product Code.


    Sales Trend.xlsx
    Sales Trend.JPG


    Data1.xls
    Data1.JPG


    Data2.xls
    Data2.JPG


    Data3.xls
    Data3.JPG
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    07-09-2013
    Location
    Nagpur, India
    MS-Off Ver
    Excel 2010 / 2013
    Posts
    293

    Re: Lookup value with multiple criteria - Data Range in multiple files

    Attached my 3 data files.
    Attached Files Attached Files

  3. #3
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Lookup value with multiple criteria - Data Range in multiple files

    Why not all data in 1 worksheet and after that analyse the data?
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  4. #4
    Forum Contributor
    Join Date
    07-09-2013
    Location
    Nagpur, India
    MS-Off Ver
    Excel 2010 / 2013
    Posts
    293

    Re: Lookup value with multiple criteria - Data Range in multiple files

    Sir, These were just for example. My actual data is divided in over 15 workbooks with many other set of office codes. So combining all in a single worksheet is a hectic task. Is it possible to get this with formulas/vba to work with existing divided data files?

  5. #5
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Lookup value with multiple criteria - Data Range in multiple files

    Is this a task you have to do often for this (same) files, or just 1 time.

    If you have to do this ofter with the same time, I would go for 1 workbook, with all data in 1 worksheet. After that I would analyse the data.

    If it was just one time, I would open the files. Rightclick in the tab-box and choose (click) for Make a copy. Then in To file, click on new file => a copy of the data are stored in a new workbook. Repeat this action for the other files.
    Last edited by oeldere; 07-05-2020 at 09:45 AM. Reason: text changed

  6. #6
    Forum Contributor
    Join Date
    07-09-2013
    Location
    Nagpur, India
    MS-Off Ver
    Excel 2010 / 2013
    Posts
    293

    Re: Lookup value with multiple criteria - Data Range in multiple files

    Sir, These data files I download now & then from sap bi portal from which I can export/view upto max 6 months data only. If I have to compile data from last 5 years or so, it will generate many files. So combining them in a single workbook 1 by 1 take much of time.

  7. #7
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Lookup value with multiple criteria - Data Range in multiple files

    I am not able to open the xls files at the moment. Since you use excel 2010 you could have post the xlsx files.

    You probably don't get my point. Since you can only download 6 months, it would be easier if you add those new information (download) in a file which already contains the values of the earlier 5 years (minus the new 6 months).

    If you do it your way, you always have to collect 9 files (4,5 year).
    Those values are already available in your earlier collection.

  8. #8
    Forum Contributor
    Join Date
    07-09-2013
    Location
    Nagpur, India
    MS-Off Ver
    Excel 2010 / 2013
    Posts
    293

    Re: Lookup value with multiple criteria - Data Range in multiple files

    Attached data files in .xlsx format.

    ps. My default exported data files are in .xls format only.
    Attached Files Attached Files

  9. #9
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Lookup value with multiple criteria - Data Range in multiple files

    Did you understand my comment?

    You did not respond on that.

    Maybe you will get trouble with the merged cells in A1 and B1.

    My advice would be don't use merged cells.

  10. #10
    Forum Contributor
    Join Date
    07-09-2013
    Location
    Nagpur, India
    MS-Off Ver
    Excel 2010 / 2013
    Posts
    293

    Re: Lookup value with multiple criteria - Data Range in multiple files

    Sir, I didn't have previously saved compiled data of past years in a single file.

  11. #11
    Forum Contributor
    Join Date
    07-09-2013
    Location
    Nagpur, India
    MS-Off Ver
    Excel 2010 / 2013
    Posts
    293

    Re: Lookup value with multiple criteria - Data Range in multiple files

    Sir, merged cells in data files are coming in every exported files by default.

  12. #12
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,421

    Re: Lookup value with multiple criteria - Data Range in multiple files

    Which version of Excel are you using?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  13. #13
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Lookup value with multiple criteria - Data Range in multiple files

    Please Login or Register  to view this content.
    How you add those information to the excel file, since it is not available?

    Please Login or Register  to view this content.
    If you use a formula for your request, the merged cells will cause problems (sooner or later).

  14. #14
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Lookup value with multiple criteria - Data Range in multiple files

    You can use the file, with the directory in cell A1.

    You can run the code below, which is in this file.

    Please Login or Register  to view this content.
    Last edited by oeldere; 07-05-2020 at 10:38 AM. Reason: text changed

  15. #15
    Forum Contributor
    Join Date
    07-09-2013
    Location
    Nagpur, India
    MS-Off Ver
    Excel 2010 / 2013
    Posts
    293

    Re: Lookup value with multiple criteria - Data Range in multiple files

    Quote Originally Posted by AliGW View Post
    Which version of Excel are you using?
    Ma'am I use Excel version 2010.

  16. #16
    Forum Contributor
    Join Date
    07-09-2013
    Location
    Nagpur, India
    MS-Off Ver
    Excel 2010 / 2013
    Posts
    293

    Re: Lookup value with multiple criteria - Data Range in multiple files

    Sir, The code created new file which I'm attaching.
    Attached Files Attached Files

  17. #17
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Lookup value with multiple criteria - Data Range in multiple files

    Yes, that is the idea, and after that you can analyse the data.

  18. #18
    Forum Contributor
    Join Date
    07-09-2013
    Location
    Nagpur, India
    MS-Off Ver
    Excel 2010 / 2013
    Posts
    293

    Re: Lookup value with multiple criteria - Data Range in multiple files

    Sir, Now it requires to get the data from 'Sheet2.xlsx' which I've uploaded to my workbook 'Sales Trend.xlsx'.

  19. #19
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Lookup value with multiple criteria - Data Range in multiple files

    There is no sheet2 in the files you added to the question.

    edit

    The filename is sheet2 (which is confusing).

    But what needs to be done with that file named sheet2.

    It is not clear (at least not clear to me).
    Last edited by oeldere; 07-05-2020 at 12:37 PM.

  20. #20
    Forum Contributor
    Join Date
    07-09-2013
    Location
    Nagpur, India
    MS-Off Ver
    Excel 2010 / 2013
    Posts
    293

    Re: Lookup value with multiple criteria - Data Range in multiple files

    Quote Originally Posted by abhinavbinkar View Post
    Sir, The code created new file which I'm attaching.
    Sir I was telling about this file which created after running the code. I've saved this file in the same folder by name Sheet2.xlsx

  21. #21
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Lookup value with multiple criteria - Data Range in multiple files

    See the question in #19

    But what needs to be done with that file named sheet2.

  22. #22
    Forum Contributor
    Join Date
    07-09-2013
    Location
    Nagpur, India
    MS-Off Ver
    Excel 2010 / 2013
    Posts
    293

    Re: Lookup value with multiple criteria - Data Range in multiple files

    Sir, I'm sorry for not able to express properly.
    I'm asking about how I can add that data in my Sales Trend.xlsx file.

  23. #23
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Lookup value with multiple criteria - Data Range in multiple files

    You question is (was) how to add the 3 (or more files) in 1 sheet.

    You get code from me, how you can achieve that.
    I'm asking about how I can add that data in my Sales Trend.xlsx file.
    You did not mentioned earlier Sales Trend.xlsx file

    Neither you did not posted this file (without confidential information).

    How should I be expected to know what needs to be done with that data / file if you can't explain it.

  24. #24
    Forum Contributor
    Join Date
    07-09-2013
    Location
    Nagpur, India
    MS-Off Ver
    Excel 2010 / 2013
    Posts
    293

    Re: Lookup value with multiple criteria - Data Range in multiple files

    Quote Originally Posted by oeldere View Post
    You question is (was) how to add the 3 (or more files) in 1 sheet.

    You get code from me, how you can achieve that.


    You did not mentioned earlier Sales Trend.xlsx file

    Neither you did not posted this file (without confidential information).

    How should I be expected to know what needs to be done with that data / file if you can't explain it.
    .
    Quote Originally Posted by abhinavbinkar View Post
    I needed to get Sales qty data from these 3 files to my workbook 'Sales Trend.xlsx' based on Office Code & Product Code.


    Sales Trend.xlsx
    Attachment 685368

    Sir, I asked for the same at my thread opening post already.
    The file does not contain any confidential info. The file has dummy figures and codes.

  25. #25
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Lookup value with multiple criteria - Data Range in multiple files

    In my earlier explanation I missed 1 step.

    first use this code in each file with data.

    Before you run this code make sure:
    1) Change the name of the sheet in Data
    2) Copy the data in row 2 (the green row)

    The result of the code is in sheet output.



    Please Login or Register  to view this content.
    After you have done that with all files.

    Use the code I gave you earlier (also in this file).

    After that a pivot table.

    See the attached file.

    A) 1files-data1
    B) 2020-07-05 (oeldere) abhinavbinkar mergefile

    The endresult is in file 2020-07-05 (oeldere) abhinavbinkar mergefile sheet PT Oeldere.

  26. #26
    Forum Contributor
    Join Date
    07-09-2013
    Location
    Nagpur, India
    MS-Off Ver
    Excel 2010 / 2013
    Posts
    293

    Re: Lookup value with multiple criteria - Data Range in multiple files

    Sir,

    First of all I'm sorry that I haven't replied coz I was unwell. I tried the code today, and some things are uncleared.


    Quote Originally Posted by oeldere View Post
    1) Change the name of the sheet in Data
    Do I need to change all my Data workbooks sheet name to 'Data' and then run the code on each workbook one by one?

    Quote Originally Posted by oeldere View Post
    2) Copy the data in row 2 (the green row)
    Not understand this step completely.


    Quote Originally Posted by oeldere View Post

    After that a pivot table.
    As I dont know abou pivot tables, can the vba code help to automate the above steps.

  27. #27
    Forum Contributor
    Join Date
    07-09-2013
    Location
    Nagpur, India
    MS-Off Ver
    Excel 2010 / 2013
    Posts
    293

    Re: Lookup value with multiple criteria - Data Range in multiple files

    Please help.

  28. #28
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Lookup value with multiple criteria - Data Range in multiple files

    Please Login or Register  to view this content.
    1) That is why you need to change the name of the file in data. The code takes the data from sheet DATA.


    HTML Code: 
    HTML Code: 
    2) You need to have the data (the green row) in row 2. (this is the row for the headers).


    3) After that you can create a pivot table to analyse the data like I did.
    Last edited by oeldere; 07-26-2020 at 04:38 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Lookup multiple criteria in multiple columns in multiple rows; return true if exists
    By ufdlim in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-07-2019, 02:03 PM
  2. Replies: 0
    Last Post: 10-16-2013, 12:42 PM
  3. [SOLVED] Lookup value from range for corresponding row where multiple criteria are met
    By 0Twintig in forum Excel Formulas & Functions
    Replies: 17
    Last Post: 09-03-2013, 01:54 PM
  4. [SOLVED] Lookup Multiple criteria with range
    By serene11111 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-21-2013, 02:36 AM
  5. Replies: 11
    Last Post: 02-07-2013, 02:22 AM
  6. [SOLVED] VBA to lookup in specified range for multiple files
    By kmfdm515 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-07-2012, 10:30 AM
  7. Replies: 1
    Last Post: 05-16-2011, 05:00 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1