Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Extracting data from large range

Someone used Excel (2003) like an old fashioned paper spreadsheet. About 50
names on column A. Column headings in Row 1 are program numbers. Columns B to
whatever, about 60 columns, are populated by fractions representing each
person's percentage of time devoted to programs. A person's total time might
be distributed from one program to a maximum of 15 programs.


I think this is a huge waste of good spreadsheet real estate. Less than 10
percent of the cells are populated.

However, what I want to do is to extract the percentages, separated by comma
if more than one, for each person into a cell, say cell DA7 for the person
whose name is in cell A7, in the same row as the person's name. Also the
corresponding programs, also separated by comma if more than one, in say cell
DB7.

Is this possible?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Extracting data from large range

If there are no cells that have spaces in them, then you could use:

=substitute(trim(b2&" "&c2&" "&d2&" "&e2&" "&f2&" "&g2&" "&h2)," ",", ")

Include all the columns you need (I got tired!).

Or you may want to use JE McGimpsey's UDF called MultiCat:
http://mcgimpsey.com/excel/udfs/multicat.html

With a minor tweak:

Public Function MultiCat( _
ByRef rRng As Excel.Range, _
Optional ByVal sDelim As String = "") _
As String
Dim rCell As Range
For Each rCell In rRng.Cells
if isempty(rcell.value) then
'skip it
else
MultiCat = MultiCat & sDelim & rCell.Text
end if
Next rCell
if multicat < "" then
MultiCat = Mid(MultiCat, Len(sDelim) + 1)
end if
End Function

If you're new to macros:

Debra Dalgleish has some notes how to implement macros he
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)

Short course:

Open your workbook.
Hit alt-f11 to get to the VBE (where macros/UDF's live)
hit ctrl-R to view the project explorer
Find your workbook.
should look like: VBAProject (yourfilename.xls)

right click on the project name
Insert, then Module
You should see the code window pop up on the right hand side

Paste the code in there.

Now go back to excel.
Into a test cell and type:
=multicat(b2:o2,", ")



abe1952 wrote:

Someone used Excel (2003) like an old fashioned paper spreadsheet. About 50
names on column A. Column headings in Row 1 are program numbers. Columns B to
whatever, about 60 columns, are populated by fractions representing each
person's percentage of time devoted to programs. A person's total time might
be distributed from one program to a maximum of 15 programs.

I think this is a huge waste of good spreadsheet real estate. Less than 10
percent of the cells are populated.

However, what I want to do is to extract the percentages, separated by comma
if more than one, for each person into a cell, say cell DA7 for the person
whose name is in cell A7, in the same row as the person's name. Also the
corresponding programs, also separated by comma if more than one, in say cell
DB7.

Is this possible?


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Extracting data from large range

Interesting points on extracting data, For extracting data i use
python for simple things,data extraction can be a time consuming
process
but for larger projects like documents, files, or the web i tried <a
href="http://www.extractingdata.com""extracting data"</a which
worked great, they build quick custom screen scrapers, extracting
data, and data parsing programs
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Extracting data from large range

Thanks, Dave. I will try your first solution.



"Dave Peterson" wrote:

If there are no cells that have spaces in them, then you could use:

=substitute(trim(b2&" "&c2&" "&d2&" "&e2&" "&f2&" "&g2&" "&h2)," ",", ")

Include all the columns you need (I got tired!).

Or you may want to use JE McGimpsey's UDF called MultiCat:
http://mcgimpsey.com/excel/udfs/multicat.html

With a minor tweak:

Public Function MultiCat( _
ByRef rRng As Excel.Range, _
Optional ByVal sDelim As String = "") _
As String
Dim rCell As Range
For Each rCell In rRng.Cells
if isempty(rcell.value) then
'skip it
else
MultiCat = MultiCat & sDelim & rCell.Text
end if
Next rCell
if multicat < "" then
MultiCat = Mid(MultiCat, Len(sDelim) + 1)
end if
End Function

If you're new to macros:

Debra Dalgleish has some notes how to implement macros he
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)

Short course:

Open your workbook.
Hit alt-f11 to get to the VBE (where macros/UDF's live)
hit ctrl-R to view the project explorer
Find your workbook.
should look like: VBAProject (yourfilename.xls)

right click on the project name
Insert, then Module
You should see the code window pop up on the right hand side

Paste the code in there.

Now go back to excel.
Into a test cell and type:
=multicat(b2:o2,", ")



abe1952 wrote:

Someone used Excel (2003) like an old fashioned paper spreadsheet. About 50
names on column A. Column headings in Row 1 are program numbers. Columns B to
whatever, about 60 columns, are populated by fractions representing each
person's percentage of time devoted to programs. A person's total time might
be distributed from one program to a maximum of 15 programs.

I think this is a huge waste of good spreadsheet real estate. Less than 10
percent of the cells are populated.

However, what I want to do is to extract the percentages, separated by comma
if more than one, for each person into a cell, say cell DA7 for the person
whose name is in cell A7, in the same row as the person's name. Also the
corresponding programs, also separated by comma if more than one, in say cell
DB7.

Is this possible?


--

Dave Peterson
.

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
Extracting data from large text files for beginner [email protected] Excel Worksheet Functions 1 November 12th 08 09:23 AM
Extracting the data according the number of cell (at specific range) wilchong via OfficeKB.com New Users to Excel 3 May 16th 08 04:57 AM
Extracting the data according the number of cell (at specific range) wilchong via OfficeKB.com New Users to Excel 0 May 15th 08 05:24 AM
Extracting/deleting select data from range of cell DipyDawg Excel Discussion (Misc queries) 4 May 6th 08 06:48 PM
Extracting data from large worksheet Louise Excel Worksheet Functions 4 April 27th 07 03:17 PM


All times are GMT +1. The time now is 08:09 PM.

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

About Us

"It's about Microsoft Excel"