• 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
  • Login

VBA Code for Extracting Numbers|VBA & Macros|Excel Forum|My Online Training Hub

You are here: Home / VBA Code for Extracting Numbers|VBA & Macros|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 ForumVBA & MacrosVBA Code for Extracting Numbers
sp_PrintTopic sp_TopicIcon
VBA Code for Extracting Numbers
Avatar
Ali Shoaib
Member
Members
Level 0
Forum Posts: 8
Member Since:
February 20, 2020
sp_UserOfflineSmall Offline
1
February 21, 2020 - 9:07 pm
sp_Permalink sp_Print

I have situation as mentioned below. I want to extract isnumber from column 1 and put in column 2 as can seen in picture.

ikl;knkjnnn749000sk 749000
ergheqrh550000sb 550000
rg100erg0000rgh 1000000
erger900000greh 900000
erg600000rg 600000
5erger00000ergerg 500000
fgb80000gg0rff 800000
fgwe6ewfgw1gweg 61
g50000f0w 500000
wef3wef1330weg 31330
gwe2300000 2300000
800000ewgweg 800000
egwweg13000wegwe00 1300000
sdg13636ghj 13636.36
36000sd 36000
sdg500000 500000
sdgsdg52500 52500
sp_AnswersTopicSeeAnswer See Answer
Avatar
Purfleet
England
Member
Members


Trusted Members
Level 4
Forum Posts: 414
Member Since:
December 20, 2019
sp_UserOfflineSmall Offline
2
February 22, 2020 - 3:07 am
sp_Permalink sp_Print

With your data in Column A try

 

Sub NumEx()

Dim r As Range
Dim c As Range
Dim i As Integer
Dim Temp As String
Dim o As String

Set r = Range("a1:a17")

For Each c In r

For i = 1 To Len(c)

Temp = Mid(c, i, 1)

If IsNumeric(Temp) = True Then
o = o & Temp
End If

Next i

c.Offset(0, 2) = o
Temp = ""
o = ""

Next c

End Sub

sp_AnswersTopicAnswer
Answers Post
Avatar
Philip Treacy
Admin
Level 10
Forum Posts: 1550
Member Since:
October 5, 2010
sp_UserOfflineSmall Offline
3
February 23, 2020 - 1:32 pm
sp_Permalink sp_Print sp_EditHistory

Hi Shoaib,

You can use a formula for this

=VALUE(TEXTJOIN("",TRUE,IFERROR(MID(A1,ROW(INDIRECT("1:100")),1)+0,"")))

If your version of Excel doesn't support dynamic arrays, you'll need to enter this with CTRL+SHIFT+ENTER

Regards

Phil

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Srikanth Amudhan, Kumud Patel
Guest(s) 8
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 880
Purfleet: 414
Frans Visser: 346
David_Ng: 306
lea cohen: 237
Jessica Stewart: 219
A.Maurizio: 213
Aye Mu: 201
Hans Hallebeek: 184
Newest Members:
Hilary Burchfield
Richie Wright
Adel Kock
Barbara Murray
Doug Milne
https://www.afabola.net/
Siobhan Stringer
Rob Rooth
Tom Lewis
Jennifer Rodriguez-Avila
Forum Stats:
Groups: 3
Forums: 24
Topics: 6540
Posts: 28628

 

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

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel Office Scripts
  • 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

Sign up to our newsletter and join over 400,000
others who learn Excel and Power BI with us.

 

Company

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

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.