+ Reply to Thread
Results 1 to 20 of 20

Merge multiple sheets data into one worksheet based on multiple criteria and date

  1. #1
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Merge multiple sheets data into one worksheet based on multiple criteria and date

    Hello,

    I am looking for an help on below explanation. Previous topic HERE. and below is the explanation in my previous topic.


    I am looking for a help to combine 2 worksheet data for non-identical headers.
    Click Search provider button on ribbon and enter search criteria (For example Quba) and click search. Below listbox1 will give the list of provider per year. When a user click any of the months (For example Al Dar Hospital (Quba) - 2015) the textbox grab that clicked text i.e. Al Dar Hospital (Quba) – 2015.

    Now what I am requesting here is when I click Export Data button then VBA Macros will look for that text value on both the worksheets i.e. Data & Resubmission Adjustment and copy entire rows on below conditions.

    1. From Worksheet data copy the entire row where the text value match.
    2. From Worksheet “Resubmission Adjustment” look for the text value and look for batch no. In column B which is present in Worksheets “Data” in column G and Worksheet “Resubmission Adjustment” in column D cell value is Resubmission Adjustment copy only those rows.

    After matching all the criteria and copy the rows and past it to the worksheet(“Statement”).

    Addition to the above I need to add one option which is date.

    after doing the above procedure if the use enter the date for example 01-01-2015 until 01-05-2015 the script extract the data for that specific provider for this period only.

    To understand the request better I am attaching the sample file (Demo).

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Merge multiple sheets data into one worksheet based on multiple criteria and date

    Good morning,
    I will see what I can do for you. Read your PM and will continue here on the post.
    Looks simple but ... most simple things result a little more complicated.
    Do you want a calendar like pop-up or just type in the dates?
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Re: Merge multiple sheets data into one worksheet based on multiple criteria and date

    Thanks for your response.

    The requirement is typing but if can be possible can we make both calendar and typing.

    At last the script will read the textbox dates of period and extract the data right.

  4. #4
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Merge multiple sheets data into one worksheet based on multiple criteria and date

    Yes the dates in the textboxes will determine the period

  5. #5
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Merge multiple sheets data into one worksheet based on multiple criteria and date

    Before I start on this.
    The dates you want to filter.

    Is that the worksheet named 'Resubmission Adjustment' column Date
    or one of the Dates in DATA but then which column?

  6. #6
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Re: Merge multiple sheets data into one worksheet based on multiple criteria and date

    Sorry for incomplete information.

    Concept is the same as before. If the period falls in both the sheets it should extract records from both sheets.

    for example:

    If the period is March 2014 to November 2014 then the rows copies from Data worksheets and if the same period the batches listed in Resubmission Adjustment worksheets then should copy that rows.

    For example Al Dar Hospital (Quba) period of March to November 2014 their are 2 batches within the same period which is NB20150929-4945 & NB20141120-6039 also been added to statement worksheets. Means extract row from Resubmission Adjustment worksheets and past to statement worksheets.

    So the main data source is from Data worksheets only.

    I how this will clear your doubt.

  7. #7
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Merge multiple sheets data into one worksheet based on multiple criteria and date

    I am sure that you understand what you are explaining but I honestly do not understand which date (based on which column) you want to make the selection.
    If you say both worksheets, does this mean only the rows of data within the date range that exist in both worksheets?

    What I need to know is clear and simple: WHAT DATE (column) DO YOU WANT ME TO FILTER ON?

  8. #8
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Re: Merge multiple sheets data into one worksheet based on multiple criteria and date

    Once again sorry for incomplete information.

    What I need to know is clear and simple: WHAT DATE (column) DO YOU WANT ME TO FILTER ON?
    The dates from column C in Data worksheets. Months date will be fixed first day of every month.


    If you say both worksheets, does this mean only the rows of data within the date range that exist in both worksheets?

    As I explained the dates if period from March 2014 to November 2014 then rows data from Data worksheets and if the same period for same provider the batches listed in Resubmission Adjustment worksheets then should copy that rows.

    For example Al Dar Hospital (Quba) period of March to November 2014 their are 2 batches within the same period which is NB20150929-4945 & NB20141120-6039 for the same provider within that period also added to statement worksheets.

    Copy of manual work as demo is attached for your reference to know what will be the output.

  9. #9
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Merge multiple sheets data into one worksheet based on multiple criteria and date

    Okay so if O understand correctly you want to be able to filter on the Billing Month?
    In the userform the resubmition batch do you want to select all or just one? of this just for information?

  10. #10
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Re: Merge multiple sheets data into one worksheet based on multiple criteria and date

    See what ever the batches from resubmission is falling in that specific period it would extract.

    Also this date option is optional. Means if the user select provider from listbox 1 and did not enter the date then it should extract whole year if it should extract the period which is mentioned in textboxes.

    For example if I select Al Dar Hospital (Quba) - 2014 on listbox1 and enter the period of March to November 2014 so it should extract data from march 2014 to November 2014 including resubmission batches within this period.

    If I just leave the textboxes blank then it should extract whole year.

  11. #11
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Merge multiple sheets data into one worksheet based on multiple criteria and date

    Okay, but if you want to select the dates (in Column C) the cells in this coloumn do NOT contain date values but text like MARCH 2014 APRIL 2014 etc.
    But a selection in ListBox2 if you have two but only want one then what?

  12. #12
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Re: Merge multiple sheets data into one worksheet based on multiple criteria and date

    That is the dummy data.

    The actual format (Custom) will be mmmm-yyyy but actual cell value will be dd-mm-yyyy (first day of every month).

    For example 01-03-2014 until 01-11-2014 this will be the date in textboxes and the data will be extract for from March to November 2014.

    See the attached sample to understand better.

  13. #13
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Merge multiple sheets data into one worksheet based on multiple criteria and date

    As you state correctly, the
    Actual format (Custom) will be mmmm-yyyy
    but this is something you have done by hand by you worksheets do not have correct date formats in any way.
    If I check the cell formats in all the date cells are not formatted as date all are format of the type General which in Excel causes a lot of issues when it comes down to comparing dates and especially if the system settings are different for each user which in my case is dd-mm-yyyyy and since you have NOT set correct format your 03-11-2014 (if you state this is March 11 2014) is interpreted by me as November 3 2014.
    This is taking up a lot of my time and I don't think I can help you with these discrepancies and not knowing what is to be filtered.

    I have attached three screenshots of the different worksheets and a module you can use to select dates which you should implement

    DATA has not format is plain text !

    Resubmission ... column C are the dates as displayed here on my system

    Statements is you manual modification

    I have attached the zipped vba modules you need to import in your file and the code to add to your userforms and the VBA Project Module

    Please Login or Register  to view this content.
    The red marked code code you place in Module1, the other part in the USerform1 and give it the name of the textboxes you use for the date

    I hope you can make it work.
    Attached Images Attached Images
    Attached Files Attached Files

  14. #14
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Merge multiple sheets data into one worksheet based on multiple criteria and date

    I inserted the code in the version you attached, so give it a try
    You will have to complete the code to use the dates, but since you know best which columns you want to filter I am sure you can do this.

  15. #15
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Re: Merge multiple sheets data into one worksheet based on multiple criteria and date

    Thanks Keeb for your details explanation. I know this is the texting (Demo data) which is not having proper date format buy when I change manually to dd-mm-yyyy date format.

    I think this format will be easy for you to work on date format.

    Copy of the data is attached.

  16. #16
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Merge multiple sheets data into one worksheet based on multiple criteria and date

    I will see if I can work something out, but since you now have the calendar in my last answer I am sure you can use that to work on it too.

  17. #17
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Merge multiple sheets data into one worksheet based on multiple criteria and date

    I might suspect that you have found it more complicated than you thought. There are many conditions to take into account.
    I have tried my best. If the month names are still in Dutch just make sure you refresh the calculations and they will be in your system's language settings again.
    Hope it works for you in this way
    Attached Files Attached Files

  18. #18
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Re: Merge multiple sheets data into one worksheet based on multiple criteria and date

    Hai Keeb,

    Thank for your all efforts which you have put into this request.

    I will thoroughly check the file and out result then get back to you to provide you a feedback.

    Thanks once again.

  19. #19
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Re: Merge multiple sheets data into one worksheet based on multiple criteria and date

    Hello Keeb,

    We are almost there. Their still more thing to understand.

    Referring to my first post we are working on combining data from 2 worksheets into 1.

    Validation will be look for a hospital in data sheets and look for the same hospital in Resubmission Adjustment sheets. After find the same hospital look for text value (Resubmission Adjustment) in column D in worksheets Resubmission Adjustment. If found extract all the data into a new worksheet.

    Now the file is including the period if user select resubmission batches.
    For example: User search provider and select for year 2014 the batches listed below. User need not to select the resubmission batches. These batches have to be included in the period which is in text box as an example march 2014 to November 2014 there are 2 batches of resubmission included in this period.

    Instead of going for long explanation I will summarized the request.

    Full Year
    1. Search for a provider
    2. Select that provider
    3. Without selecting resubmission batches (This is only for viewing purpose).
    4. Click on export button. (This will extract entire data for that selected year.

    Partially Period
    1. Search for a provider
    2. Select that provider
    3. Without selecting resubmission batches (This is only for viewing purpose) if exists.
    4. Enter start date and end sate in the text boxes.
    5. Click on export button. (This will extract entire data for that selected year and period mentioned in the text boxes.

    I hope this will get you the better idea of output. If not I am attaching the both samples (Full Year & Specific Period)

  20. #20
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    900

    Re: Merge multiple sheets data into one worksheet based on multiple criteria and date

    Topic Marked As Solved And Reputation Added.

+ 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. Replies: 29
    Last Post: 01-01-2017, 10:25 AM
  2. Select a cell at random based on multiple selection criteria across multiple sheets.
    By scottyms in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-03-2016, 09:44 AM
  3. [SOLVED] Merge multiple sheets data into one worksheet based on multiple criteria
    By hecgroups in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 01-05-2016, 10:32 AM
  4. Compare and Merge Data from Multiple Sheets in a worksheet
    By joeexcell in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-07-2012, 09:08 PM
  5. Search multiple sheets for value based on criteria and copy data accordingly
    By Zagadka in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-31-2012, 08:46 AM
  6. Replies: 0
    Last Post: 07-27-2011, 01:00 AM
  7. Copy data from multiple sheets based on certain criteria!!
    By missyk77 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-24-2010, 12:05 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