Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Joe Joe is offline
external usenet poster
 
Posts: 476
Default Rearranging and Indexing a column array

I have an array of 100 columns X 15 rows A1:CV15

Each column contains the words of a single line from a document up to a
maximum of 15.

Some of 15 end cells are blanks since not all lines are equal in length.

It is required to index (Book Index) all these words into a single column
with the line numbers from which it came into a column alongside. That is we
need to know the line number of each word in the original document.

The tricky bit here is how to index the line numbers alongside the words
before
using VBA code to move sequentially all the columns into one one.
  #2   Report Post  
Posted to microsoft.public.excel.misc
bj bj is offline
external usenet poster
 
Posts: 1,397
Default Rearranging and Indexing a column array

yoou really dont need to use VBA
insert two new columns in A and B
in A1 enter
=(INT((ROW()-1)/15)+1)
in B1 enter
=index(C1:CX15,MOD(ROW()-1,15)+1,INT((ROW()-1)/15)+3)
Copy A1:B1
to A1:B1500
Select A1:B1500

copy and paste special values
"Joe" wrote:

I have an array of 100 columns X 15 rows A1:CV15

Each column contains the words of a single line from a document up to a
maximum of 15.

Some of 15 end cells are blanks since not all lines are equal in length.

It is required to index (Book Index) all these words into a single column
with the line numbers from which it came into a column alongside. That is we
need to know the line number of each word in the original document.

The tricky bit here is how to index the line numbers alongside the words
before
using VBA code to move sequentially all the columns into one one.

  #3   Report Post  
Posted to microsoft.public.excel.misc
Joe Joe is offline
external usenet poster
 
Posts: 476
Default Rearranging and Indexing a column array

This formula did'nt work out for me.

I will explain with a smaller array.

Take a (3 columns X 4 rows) array such as A1:C4
with the following data
A E H
B F I
C G J
D K
The first column ABCD is the first line and all cells in it get the index=1
The second column EFG blank gets index=2 etc.
What is needed is column with this result A 1
B 1
C 1
D 1
E 2
F 2
G 2
H 3
I 3
J 3
K 3
"bj" wrote:

yoou really dont need to use VBA
insert two new columns in A and B
in A1 enter
=(INT((ROW()-1)/15)+1)
in B1 enter
=index(C1:CX15,MOD(ROW()-1,15)+1,INT((ROW()-1)/15)+3)
Copy A1:B1
to A1:B1500
Select A1:B1500

copy and paste special values
"Joe" wrote:

I have an array of 100 columns X 15 rows A1:CV15

Each column contains the words of a single line from a document up to a
maximum of 15.

Some of 15 end cells are blanks since not all lines are equal in length.

It is required to index (Book Index) all these words into a single column
with the line numbers from which it came into a column alongside. That is we
need to know the line number of each word in the original document.

The tricky bit here is how to index the line numbers alongside the words
before
using VBA code to move sequentially all the columns into one one.

  #4   Report Post  
Posted to microsoft.public.excel.misc
bj bj is offline
external usenet poster
 
Posts: 1,397
Default Rearranging and Indexing a column array

MIA CULPA

in A1
=index($C$1:$C$X15,MOD(ROW()-1,15)+1,INT((ROW()-1)/15)+1)
(I forgot to make the reference be absolute)

in B1
enter
=(INT((ROW()-1)/15)+1)
copy A1:B1
Select A1:B1500
paste
copy A1:B1500
select A1 and paste special values

With A1B1500 Selected
data-filter-autofilter
in column B Select 0
Select all the rows with Zeros and edit delete rows.

caution in the first 15 rows you might want to delete the cells separately
so that you do not delete any of your original data
and if you have "0"s anywhere in your word list it needs to be watched for
so that it doesn't get deleted.
"Joe" wrote:

This formula did'nt work out for me.

I will explain with a smaller array.

Take a (3 columns X 4 rows) array such as A1:C4
with the following data
A E H
B F I
C G J
D K
The first column ABCD is the first line and all cells in it get the index=1
The second column EFG blank gets index=2 etc.
What is needed is column with this result A 1
B 1
C 1
D 1
E 2
F 2
G 2
H 3
I 3
J 3
K 3
"bj" wrote:

yoou really dont need to use VBA
insert two new columns in A and B
in A1 enter
=(INT((ROW()-1)/15)+1)
in B1 enter
=index(C1:CX15,MOD(ROW()-1,15)+1,INT((ROW()-1)/15)+3)
Copy A1:B1
to A1:B1500
Select A1:B1500

copy and paste special values
"Joe" wrote:

I have an array of 100 columns X 15 rows A1:CV15

Each column contains the words of a single line from a document up to a
maximum of 15.

Some of 15 end cells are blanks since not all lines are equal in length.

It is required to index (Book Index) all these words into a single column
with the line numbers from which it came into a column alongside. That is we
need to know the line number of each word in the original document.

The tricky bit here is how to index the line numbers alongside the words
before
using VBA code to move sequentially all the columns into one one.

  #5   Report Post  
Posted to microsoft.public.excel.misc
Joe Joe is offline
external usenet poster
 
Posts: 476
Default Rearranging and Indexing a column array

Thanks bj. It works well. I must say I have never used the filter function
before.It
is so useful.

"bj" wrote:

MIA CULPA

in A1
=index($C$1:$C$X15,MOD(ROW()-1,15)+1,INT((ROW()-1)/15)+1)
(I forgot to make the reference be absolute)

in B1
enter
=(INT((ROW()-1)/15)+1)
copy A1:B1
Select A1:B1500
paste
copy A1:B1500
select A1 and paste special values

With A1B1500 Selected
data-filter-autofilter
in column B Select 0
Select all the rows with Zeros and edit delete rows.

caution in the first 15 rows you might want to delete the cells separately
so that you do not delete any of your original data
and if you have "0"s anywhere in your word list it needs to be watched for
so that it doesn't get deleted.
"Joe" wrote:

This formula did'nt work out for me.

I will explain with a smaller array.

Take a (3 columns X 4 rows) array such as A1:C4
with the following data
A E H
B F I
C G J
D K
The first column ABCD is the first line and all cells in it get the index=1
The second column EFG blank gets index=2 etc.
What is needed is column with this result A 1
B 1
C 1
D 1
E 2
F 2
G 2
H 3
I 3
J 3
K 3
"bj" wrote:

yoou really dont need to use VBA
insert two new columns in A and B
in A1 enter
=(INT((ROW()-1)/15)+1)
in B1 enter
=index(C1:CX15,MOD(ROW()-1,15)+1,INT((ROW()-1)/15)+3)
Copy A1:B1
to A1:B1500
Select A1:B1500

copy and paste special values
"Joe" wrote:

I have an array of 100 columns X 15 rows A1:CV15

Each column contains the words of a single line from a document up to a
maximum of 15.

Some of 15 end cells are blanks since not all lines are equal in length.

It is required to index (Book Index) all these words into a single column
with the line numbers from which it came into a column alongside. That is we
need to know the line number of each word in the original document.

The tricky bit here is how to index the line numbers alongside the words
before
using VBA code to move sequentially all the columns into one one.

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
How to manipulate an 2D Array into a Column Array? Joe Excel Discussion (Misc queries) 3 April 16th 07 06:30 PM
Finding a number in a column out of an array in another column cirena Excel Discussion (Misc queries) 3 April 4th 07 06:30 PM
Rearranging a date Janice B. - Cleveland, Ohio Excel Worksheet Functions 3 March 14th 07 06:43 PM
Rearranging numbers Gary''s Student Excel Discussion (Misc queries) 0 November 29th 06 02:45 PM
Indexing an Array with VLOOKUP Joe Blow Excel Worksheet Functions 1 March 14th 05 09:23 PM


All times are GMT +1. The time now is 01:37 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"