Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default How to pop out individual data from cluster of data

Cell A1 has 345-347,456;567,720
In column B, I would like to extract the above data as under:

B1 345
B2 346
B3 347
B4 456
B5 567
B6 720
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default How to pop out individual data from cluster of data

Hi,

If I understand correctly then when there is a - you want the numbers
missing in the range. If I'm correct then try this

Sub SplitOut()
rowno = 1
Dim numstring As Variant
numstring = Range("A1").Value
numstring = WorksheetFunction.Substitute(numstring, " ", "")
numstring = WorksheetFunction.Substitute(numstring, ";", ",")
s = Split(numstring, ",")
For x = 0 To UBound(s)
If InStr(s(x), "-") 0 Then
t = Split(s(x), "-")
For y = Val(t(0)) To Val(t(UBound(t)))
Cells(rowno, 8).Value = y
rowno = rowno + 1
Next
Else
Cells(rowno, 8).Value = Val(s(x))
rowno = rowno + 1
End If
Next
End Sub

Mike

"GINN" wrote:

Cell A1 has 345-347,456;567,720
In column B, I would like to extract the above data as under:

B1 345
B2 346
B3 347
B4 456
B5 567
B6 720

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default How to pop out individual data from cluster of data

Hi ,

should I use this as user-defined function or If I straight away copy your
formula in the reference cell to get the desired answer. Pl. let me know how
to try your suggestion in excel work sheet functions.


"Mike H" wrote:

Hi,

If I understand correctly then when there is a - you want the numbers
missing in the range. If I'm correct then try this

Sub SplitOut()
rowno = 1
Dim numstring As Variant
numstring = Range("A1").Value
numstring = WorksheetFunction.Substitute(numstring, " ", "")
numstring = WorksheetFunction.Substitute(numstring, ";", ",")
s = Split(numstring, ",")
For x = 0 To UBound(s)
If InStr(s(x), "-") 0 Then
t = Split(s(x), "-")
For y = Val(t(0)) To Val(t(UBound(t)))
Cells(rowno, 8).Value = y
rowno = rowno + 1
Next
Else
Cells(rowno, 8).Value = Val(s(x))
rowno = rowno + 1
End If
Next
End Sub

Mike

"GINN" wrote:

Cell A1 has 345-347,456;567,720
In column B, I would like to extract the above data as under:

B1 345
B2 346
B3 347
B4 456
B5 567
B6 720

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default How to pop out individual data from cluster of data

You would use as a macro.

If you're not familiar with VBA and macros, see David McRitchie's site for
more on "getting started".

http://www.mvps.org/dmcritchie/excel/getstarted.htm

or Ron de De Bruin's site on where to store macros.

http://www.rondebruin.nl/code.htm

In the meantime..........

First...create a backup copy of your original workbook.

To create a General Module, hit ALT + F11 to open the Visual Basic Editor.

Hit CRTL + r to open Project Explorer.

Find your workbook/project and select it.

Right-click and InsertModule. Paste the code in there. Save the
workbook and hit ALT + Q to return to your workbook.

Run or edit the macro by going to ToolMacroMacros.

You can also assign this macro to a button or a shortcut key combo.


Gord Dibben MS Excel MVP

On Mon, 21 Sep 2009 10:22:01 -0700, GINN
wrote:

Hi ,

should I use this as user-defined function or If I straight away copy your
formula in the reference cell to get the desired answer. Pl. let me know how
to try your suggestion in excel work sheet functions.


"Mike H" wrote:

Hi,

If I understand correctly then when there is a - you want the numbers
missing in the range. If I'm correct then try this

Sub SplitOut()
rowno = 1
Dim numstring As Variant
numstring = Range("A1").Value
numstring = WorksheetFunction.Substitute(numstring, " ", "")
numstring = WorksheetFunction.Substitute(numstring, ";", ",")
s = Split(numstring, ",")
For x = 0 To UBound(s)
If InStr(s(x), "-") 0 Then
t = Split(s(x), "-")
For y = Val(t(0)) To Val(t(UBound(t)))
Cells(rowno, 8).Value = y
rowno = rowno + 1
Next
Else
Cells(rowno, 8).Value = Val(s(x))
rowno = rowno + 1
End If
Next
End Sub

Mike

"GINN" wrote:

Cell A1 has 345-347,456;567,720
In column B, I would like to extract the above data as under:

B1 345
B2 346
B3 347
B4 456
B5 567
B6 720


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Put data into individual worksheets kjstec New Users to Excel 4 April 14th 09 08:53 PM
cluster column chart with data point labels robotman Charts and Charting in Excel 2 June 12th 07 09:51 PM
is it only appropriate to insert *different* data into *individual* cells... showsomeidnow Excel Discussion (Misc queries) 5 April 30th 07 09:33 PM
Autofit data in each individual cell tepickles Excel Discussion (Misc queries) 1 December 29th 06 05:13 AM
individual tabs for subtotaled data scott Excel Discussion (Misc queries) 3 July 30th 06 03:55 PM


All times are GMT +1. The time now is 12:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"