• 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

how split information in different columns?|General Excel Questions & Answers|Excel Forum|My Online Training Hub

You are here: Home / how split information in different columns?|General Excel Questions & Answers|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search
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 ForumGeneral Excel Questions & Answe…how split information in different …
sp_PrintTopic sp_TopicIcon
how split information in different columns?
Avatar
m r

New Member
Members
Level 0
Forum Posts: 2
Member Since:
October 10, 2020
sp_UserOfflineSmall Offline
1
October 10, 2020 - 2:38 am
sp_Permalink sp_Print

In column A I have text like mentioned below. I am trying to separate the City Name and date in two separate columns. I don't need the other text.

Alameda 1-10-20 CSV-PAY SUMMARY RUN.csv
Palm Harbor 1-15-20 Hourly CSV-PAY SUMMARY RUN.csv
Palm Harbor 1-15-20 Salary CSV-PAY SUMMARY RUN.csv

Basically, there are various combinations like above and there are different city names. I tried using mid, search, left, right, but its not helping.

 

I need name of city in one column and date in another.

Will appreciate help.

sp_AnswersTopicSeeAnswer See Answer
Avatar
Purfleet
England
Member
Members


Trusted Members
Level 4
Forum Posts: 412
Member Since:
December 20, 2019
sp_UserOfflineSmall Offline
2
October 10, 2020 - 9:31 am
sp_Permalink sp_Print sp_EditHistory

There will definitely be a better way with power query, where you can split on a number, but in the meantime, this seems to work on the small data set provided.

=TRIM(MID(A2,1,MATCH(1,--ISNUMBER(MID(A2,ROW($A$1:INDIRECT("$A$"&$B$1)),1)+0),0)-1))

In cell B1 we have the max length of the text in column A, so i can create an array of numbers 1 to the max length. This goes inside the second MID to check if each character is a number, match then finds the first number.

So, we then have the first mid which is basically the text in A2 starting at the first character and extracting up to the character before the first number.

Trim just removes the spaces

If there are any cities that contain a number, it won’t work!

You need to test it on a much larger dataset

sp_AnswersTopicAnswer
Answers Post
Avatar
Philip Treacy
Admin
Level 10
Forum Posts: 1514
Member Since:
October 5, 2010
sp_UserOfflineSmall Offline
3
October 10, 2020 - 1:37 pm
sp_Permalink sp_Print

Hi m r,

Attached is a solution using Power Query.  I also did one with formulae, different to Purfleet.  You can't have too many options.

To extract the city

=TRIM(MID(SUBSTITUTE(SUBSTITUTE (SUBSTITUTE($A1,"Hourly ",""), "Salary ",""), " CSV-PAY SUMMARY RUN.csv",""), 1,FIND(C1,A1)-2))

and the date

=TRIM(RIGHT(SUBSTITUTE (SUBSTITUTE(SUBSTITUTE ($A1,"Hourly ",""), "Salary ",""), " CSV-PAY SUMMARY RUN.csv", ""),8))

These only work with data as provided in your example.  If your complete data is different then adjustments will need to be made.

Regards

Phil

The following users say thank you to Philip Treacy for this useful post:

Purfleet
Avatar
m r

New Member
Members
Level 0
Forum Posts: 2
Member Since:
October 10, 2020
sp_UserOfflineSmall Offline
4
October 12, 2020 - 10:28 pm
sp_Permalink sp_Print

Thanks guys! Really appreciate. I’ll try to add these formulas in my dataset. However, I too came up with another solution

For City: I used search function to find hypen and subtracted 2 from that and nested that in Left function to extract city names. And similar with slightly different search function to get dates and extracted using Right function. Only catch is if there’s another word in between city names and date then that too gets extracted, but i can add one more column and separate those. Thats and much appreciated!

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Catalin Bombea, Aislinn Mellamphy, Lynnette Altomari, Roy Lutke, Dieneba NDIAYE, Tucker Oakley, Natasha Smith
Guest(s) 12
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
Jessica Stewart: 202
A.Maurizio: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
Sopi Yuniarti
sandra parker
LAFONSO HERNANDEZ
Hayden Hao
Angela chen
Sean Moore
John Chisholm
vexokeb sdfg
John Jack
Malcolm Toy
Forum Stats:
Groups: 3
Forums: 24
Topics: 6215
Posts: 27244

 

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