• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

Extract Multiple Rows into a Limited Template based on Multiple Criterias|VBA & Macros|Excel Forum|My Online Training Hub

You are here: Home / Extract Multiple Rows into a Limited Template based on Multiple Criterias|VBA & Macros|Excel Forum|My Online Training Hub

vba course banner

Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search|Last Search Results
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumVBA & MacrosExtract Multiple Rows into a Limite…
sp_PrintTopic sp_TopicIcon
Extract Multiple Rows into a Limited Template based on Multiple Criterias
Avatar
Albert D

Active Member
Members
Level 0
Forum Posts: 3
Member Since:
January 8, 2020
sp_UserOfflineSmall Offline
1
January 8, 2020 - 11:10 pm
sp_Permalink sp_Print

Dear All,

I understand that this might be a long process, So I thought we can take it solve the intentions one by one and I would keep on editing the post 🙂

I have a data dump that I want to extract into a template and be printed out.

Here are my intentions:

1. From the data dump (sample above), is it possible to automatically extract the appropriate value into the Template with a maximum of 10 rows for each set of Template.
Each template would be either limited daily OR maximum of 10 transactions as long as they are from the same credit source.

2. Values for the templates are:
3. Credit Source = Source + Source Name
4. Total = All values inside the voucher
5. Account = Item Code
6. Detail = Item Name
7. Unit Code = Unit Code
8. Value = Total Debit

9. As the datadump is extensive, is it possible to have ~10 sets of template in 1 Sheet and once they are printed out individually, they are deleted?

10. And Finally, to colour code for those that have been extracted to the template

Since I am new to VBA, I would have no issue with the inputs to their appropriate places and to colour code. But I am still learning about the loop function that I believe would be required for this?

Any help would be much appreciated!Initial.PNGImage Enlarger

Capture.PNGImage Enlarger
Final.PNGImage Enlarger

sp_PlupAttachments Attachments
  • sp_PlupImage Initial.PNG (159 KB)
  • sp_PlupImage Capture.PNG (24 KB)
  • sp_PlupImage Final.PNG (186 KB)
Avatar
Purfleet
England
Member
Members


Trusted Members
Level 4
Forum Posts: 414
Member Since:
December 20, 2019
sp_UserOfflineSmall Offline
2
January 9, 2020 - 6:08 am
sp_Permalink sp_Print

So you want a template created for each Souce & day?

This would be invoice 1 (99909900 for the 01/01/2020)

Date Item Code Item Name Unit Code Quantity  Value   Total Debit  Souce Source Name Quantity  Value   Total Credit 
01/01/2020 00000001 Item A ABC123 1              2,000                          2,000 99909900 A 1              2,000                            2,000
01/01/2020 00000004 Item D LLL000 1 131                              131 99909900 A 1 131                                131
01/01/2020 00000005 Item E LLL000 5 550                          2,750 99909900 A 5 550                            2,750
01/01/2020 00000005 Item E LLL000 5 550                          2,750 99909900 A 5 550                            2,750

This would be invoice 2 (99909900 for the 02/01/2020)

Date Item Code Item Name Unit Code Quantity  Value   Total Debit  Souce Source Name Quantity  Value   Total Credit 
02/01/2020 00000002 Item B ABC122 1              3,500                          3,500 99909900 B 1              3,500                            3,500
02/01/2020 00000002 Item B ABC122 1              3,500                          3,500 99909900 B 1              3,500                            3,500

and then the same for the next Souce and so on?

And the template would look like the Below? Is it mapped correctly? what goes in the yellow boxes?

template1-1.pngImage Enlarger

sp_PlupAttachments Attachments
  • sp_PlupImage template1-1.png (16 KB)
Avatar
Albert D

Active Member
Members
Level 0
Forum Posts: 3
Member Since:
January 8, 2020
sp_UserOfflineSmall Offline
3
January 9, 2020 - 12:29 pm
sp_Permalink sp_Print

Hi Purfleet!

Thank you very much for replying!
Yes please! and if there is more than 10 transactions for that source on the same day, is it possible to split them into X no. of vouchers?
Yellow boxes would be the Item Code 🙂

I have provided a before and after for reference example.

 

And love that name!

Avatar
Albert D

Active Member
Members
Level 0
Forum Posts: 3
Member Since:
January 8, 2020
sp_UserOfflineSmall Offline
4
January 9, 2020 - 3:52 pm
sp_Permalink sp_Print

Further clarification of the purpose:

Here are my intentions:

1. From the data dump (sample above), is it possible to automatically extract the appropriate value into the Template with a maximum of 10 rows for each set of [Template][2]. And then colour-code those that have been printed to the Template.

These are the Template (Payment Voucher) limitations:

a. Each template contains the data from only **1 (one) day**

If in 1st January 2020 & 2nd January 2020, there are 5 transactions **/day**, there would have to be **2 Templates (1 for each day).**

b. Each Template should only be from **1 Source**

So if in 1st January 2020 & 2nd January 2020, there are 5 transactions/day from **each Source A & B**, there would be **4 Templates (1 for each source/day)**.

c. Each template could only contain **10 lines.**

So if in 1st January 2020 & 2nd January 2020, there are **11** transactions/day from each Source A & B, there would be **8 Templates (2 for each source/day)**.

Avatar
Purfleet
England
Member
Members


Trusted Members
Level 4
Forum Posts: 414
Member Since:
December 20, 2019
sp_UserOfflineSmall Offline
5
January 12, 2020 - 7:34 pm
sp_Permalink sp_Print

Hi Albert

To check that i am on the right tracks, can you please have a look at the attached workbook.

It has a macro to extract all the dates in column A and all the Sources in column I, then apply them, in turn, to the datadump page and create a new work sheet for each one - therefore the 51 records will be split out in to however many worksheets. There is also a button to get back to just the datadump and template rather than manually deleting loads of worksheets.

Dont worry about the over 10 records part yet, just want to know that i am splitting the data up correctly

Purfleet

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Kumud Patel
Guest(s) 9
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 873
Purfleet: 414
Frans Visser: 346
David_Ng: 306
lea cohen: 222
Jessica Stewart: 218
A.Maurizio: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
Gilbert Lemek
Ashleigh Farquharson
Jayz Luu
Fred Smith
Charles DeGraffenreaid
Cathi Giard
Sarah Young
Henry Delgado
Alita Nieuwoudt
KL KOH
Forum Stats:
Groups: 3
Forums: 24
Topics: 6360
Posts: 27812

 

Member Stats:
Guest Posters: 49
Members: 32340
Moderators: 3
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.