+ Reply to Thread
Results 1 to 10 of 10

Power Query to replace macros

  1. #1
    Forum Contributor
    Join Date
    06-19-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Office365
    Posts
    276

    Power Query to replace macros

    Hello,
    I'm using excel 2016 and just wondering if I can use power query to replace a bunch of macros in a reconciliation workbook.

    what my macros do is to compile over 50 txt files into one, do some data cleaning and dump the data in a workbook (1st sheet), then go to a different folder to open 50+ CSV files and clean those up and dump into another sheet in the same workbook. then compare the two files using index/match formulas, then add a worksheet and copy and paste the unreconciled items to a that worksheet.

    I know I can upload the files onto power query but can I do the comparison part DIRECLY in the query steps so the whole process can be done in Power query?

    thanks

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Power Query to replace macros

    Yes.

    Upload a couple of sample files, and a workbook with your expected output.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Forum Contributor
    Join Date
    06-19-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Office365
    Posts
    276

    Re: Power Query to replace macros

    Thanks for your help, I've attached the file (just to show the idea, this is only a tiny part of the data - I was asked to automate our bank reconciliation process for 4 Business units that have different data source and type of transactions). If you could please show me how to do the comparison part in Power Query I'll figure out the rest myself. thanks so much!
    Attached Files Attached Files

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Power Query to replace macros

    What am I looking at? Your file doesn't help clarify your requirement / issue at all.

  5. #5
    Forum Contributor
    Join Date
    06-19-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Office365
    Posts
    276

    Re: Power Query to replace macros

    I'm so sorry, I uploaded the wrong file!! The tab CSV has the data coming from the CSV files and the tab Txt has the data from the txt files. there are two pivot tables on each to sum at the account level. then the unreconciled portion gets copied and pasted to the tab "Unreconciled". I'm so sorry again!!
    Attached Files Attached Files
    Last edited by lynnsong986; 11-08-2019 at 10:19 AM.

  6. #6
    Registered User
    Join Date
    06-09-2013
    Location
    Houston, TX
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Power Query to replace macros

    I was watching courses on Excel Power Query by Alan Murray at his site computergaga <dot> com and thought this might help your situation:

    combine-multiple-worksheets-into-one-with-append-query

  7. #7
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Power Query to replace macros

    This should do what you want:

    Please Login or Register  to view this content.
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    06-19-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Office365
    Posts
    276

    Re: Power Query to replace macros

    Thanks so much for your time Olly! wow these look very different from the normal coding I know of...great to learn something new!!

    Can you please let me know where I should place these codes? in a regular sub?
    Last edited by lynnsong986; 11-12-2019 at 10:34 AM.

  9. #9
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Power Query to replace macros

    Have a look at the video link in my signature for how to use Power Query code.

    You'll note in the workbook I attached, that I have created queries for each of your TXT and CSV sources, which simply point at the tables of data in your workbook. My query above references those queries. I assume in your workflow that you have created / will create queries to aggregate your TXT / CSV source data.

  10. #10
    Forum Contributor
    Join Date
    06-19-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Office365
    Posts
    276

    Re: Power Query to replace macros

    oh I see there are codes associated with each query step... thank you so much!

+ 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] Power Pivot does not load new column added in Power query
    By ibuhary in forum Excel General
    Replies: 12
    Last Post: 02-19-2019, 03:53 AM
  2. Power Query - Replace If Text is Found
    By brent_milne in forum Excel General
    Replies: 1
    Last Post: 10-25-2018, 11:00 AM
  3. [SOLVED] Power Query - One works the other does not (replace with if statement) - Why?
    By learning new things in forum Excel General
    Replies: 13
    Last Post: 08-20-2018, 09:46 PM
  4. Sub-Forum for Excel Power Tools (Power Query, Power Pivot & Power BI)
    By chullan88 in forum Suggestions for Improvement
    Replies: 10
    Last Post: 06-28-2018, 02:25 PM
  5. Replies: 0
    Last Post: 04-05-2018, 01:16 AM
  6. [SOLVED] Power Query - Find and Replace Line Breaks
    By ibuhary in forum Excel General
    Replies: 4
    Last Post: 03-27-2018, 05:33 AM
  7. Power query - replace all contents if word appears
    By rewdsaDSAdas in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-08-2017, 04:27 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