• 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

within Column, remove rows dates, keep rows with text|Power Query|Excel Forum|My Online Training Hub

You are here: Home / within Column, remove rows dates, keep rows with text|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 Querywithin Column, remove rows dates, k…
sp_PrintTopic sp_TopicIcon
within Column, remove rows dates, keep rows with text
Avatar
Lisa Mitten

Active Member
Members

Dashboards

Power Pivot

Power BI

Excel Expert

Power Query
Level 0
Forum Posts: 4
Member Since:
August 23, 2019
sp_UserOfflineSmall Offline
1
March 3, 2023 - 5:18 am
sp_Permalink sp_Print

I have a query 

Using from folder to collate multiple sheets into one file & stripping out unwanted data

I need to strip out everything but the lines I have highlighted.

These change each month, so Nov 2022 becomes Dec 2022 and YTD updates with Dec numbers.

I just want those two lines each month and able to update from past month to current month capturing the new month's number as well as the new YTD number.

YTD starts over in new year

YTD comes over as a text, the Dec 2022 appears to come over as a date

I tried something like and it captures the YTD but not the Dec 2022

if Text.Length(Text.BeforeDelimiter([Date],"0",0)) = 1 then 0 else Text.Length([Date])-Text.Length(Text.Replace([Date]," ",""))+1

 

Thank you in advance for assistance PQ.JPGImage Enlarger

Avatar
Philip Treacy
Admin
Level 10
Forum Posts: 1511
Member Since:
October 5, 2010
sp_UserOfflineSmall Offline
2
March 3, 2023 - 8:43 am
sp_Permalink sp_Print sp_EditHistory

Hi Lisa,

The 'dates' column is text, you can tell because all the values are aligned to the left of the column. The icon in the column header is also ABC 123 rather than the calendar icon which indicates a column of dates.

To keep just those 2 rows you can sort the column then remove other rows.

If you sort in Ascending Order you can keep the last 2 rows: Home tab -> Keep Rows -> Keep Bottom Rows

Is that all you want to do?  I wasn't sure what you meant by and able to update from past month to current month capturing the new month's number as well as the new YTD number.

Regards

Phil

Avatar
Lisa Mitten

Active Member
Members

Dashboards

Power Pivot

Power BI

Excel Expert

Power Query
Level 0
Forum Posts: 4
Member Since:
August 23, 2019
sp_UserOfflineSmall Offline
3
March 4, 2023 - 6:09 am
sp_Permalink sp_Print

Hi Phil

I have multiple clients that change each month, one month may have 25 clients the next 28 clients

Each month the data changes.  i.e. I am about to run it and the Jan 2023 will be replaced with February 2023.  

I will need to grab the Feb 2023 line which is the total of the daily data and the new YTD for each clients.  

I uploaded a data tab that had a few clients and another tab that has what I need

Clients change each month, some the same, some not
Monthly data changes each month, i.e. Dec updates to Jan, Jan to Feb etc.
YTD changes each month

Avatar
Philip Treacy
Admin
Level 10
Forum Posts: 1511
Member Since:
October 5, 2010
sp_UserOfflineSmall Offline
4
March 4, 2023 - 12:34 pm
sp_Permalink sp_Print

Hi Lisa,

you can do this by:

1. Loading the table and duplicate the query so you have 2 queries.

2. In the first query filter out any rows that do not contain YTD in the date column, this is now Table1.

3. In the other query (Table 2) filter out rows that DO contain YTD. This leaves you with just dates in the date column.

4. Filter the Date column to keep only the earliest dates.  This gives you the first of the month for each client.  there are 2 rows for each client because you have the individual entry as well as the total for the month.

5. Sort the rows by Client Name (Ascending) and Payment1 (Ascending).  For each client the 2nd row is now the end of month value.

6. Add an Index column starting from 1

7. Remove the odd numbered rows, using the Index column values

8. Append the 2 queries

Regards

Phil

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Ivica Cvetkovski
Guest(s) 10
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 870
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 219
A.Maurizio: 202
Jessica Stewart: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
Ivica Cvetkovski
Blaine Cox
Shankar Srinivasan
riyepa fdgf
Hannah Cave
Len Matthews
Kristine Arthy
Michelle Neven
Andrew Kuhn
Angela Paul
Forum Stats:
Groups: 3
Forums: 24
Topics: 6206
Posts: 27202

 

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