• 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
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

PQ Novice - Info from one row on two lines|Power Query|Excel Forum|My Online Training Hub

You are here: Home / PQ Novice - Info from one row on two lines|Power Query|Excel Forum|My Online Training Hub
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 ForumPower QueryPQ Novice - Info from one row on tw…
sp_PrintTopic sp_TopicIcon
PQ Novice - Info from one row on two lines
Avatar
Patrick Fenna

New Member
Members
Level 0
Forum Posts: 2
Member Since:
October 18, 2022
sp_UserOfflineSmall Offline
1
October 18, 2022 - 5:34 pm
sp_Permalink sp_Print

I have unstructured data in a text file taken from a mainframe. I have used PQ to import the data successfully, however the info from each line is spread across two cells vertically. For example I have Joe Bloggs but Joe is in the first cell and Bloggs is in the cell below. How do I combine these cells together?  I've been told that it would be something to do with using two index columns but I'm not sure how that works.

The data also comes in "pages" so the details of the file are scattered throughout whenever the system creates a new page. I need an automated way to get rid of those too as the placement could be different each time.

I have included the sample data text file and the beginnings of my PQ file.

I'm using Excel 2016.

thanks in advance

Paddy

sp_AnswersTopicSeeAnswer See Answer
Avatar
Riny van Eekelen
Örnsköldsvik, Sweden
Moderator
Members


Trusted Members

Moderators

Power BI
Level 0
Forum Posts: 442
Member Since:
January 31, 2022
sp_UserOfflineSmall Offline
2
October 18, 2022 - 6:17 pm
sp_Permalink sp_Print sp_EditHistory

Hi Patrick,

Have a look at the attached file and see if you can follow. Duplicated your query and created my own with some extra clean-up steps, resulting in a table with two rows per Reference. Then added two index columns. One zero-based (I named the step Index0), the other one-based (I named the step Index1). Now you can merge the table with itself, "linking" Index1 to Index0. Expand, the merged tables and do some more clean-up.

Riny

PS: Obviously, you need to point the Source step to your own txt-file.

sp_AnswersTopicAnswer
Answers Post
Avatar
Patrick Fenna

New Member
Members
Level 0
Forum Posts: 2
Member Since:
October 18, 2022
sp_UserOfflineSmall Offline
3
October 18, 2022 - 8:47 pm
sp_Permalink sp_Print

Thanks Riny,

This was a huge help and I have managed to recreate this on the actual data.

Avatar
Riny van Eekelen
Örnsköldsvik, Sweden
Moderator
Members


Trusted Members

Moderators

Power BI
Level 0
Forum Posts: 442
Member Since:
January 31, 2022
sp_UserOfflineSmall Offline
4
October 18, 2022 - 9:09 pm
sp_Permalink sp_Print

Glad I could help!

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Catalin Bombea, Velouria
Guest(s) 11
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 871
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 219
Jessica Stewart: 204
A.Maurizio: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
Murat Hasanoglu
Brett Dryland
Saeed Aldousari
Bhuwan Devkota
Kathryn Patton
Maria Conatser
Jefferson Granemann
Glen Coulthard
Nikki Fox
Rachele Dickie
Forum Stats:
Groups: 3
Forums: 24
Topics: 6222
Posts: 27291

 

Member Stats:
Guest Posters: 49
Members: 31913
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.