Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 66
Default How to find the first row not equal to the value in the first row?

Excel 2003

I often get data files from instruments where many initial rows all have the
same value, typically zero, but not limited to that. Often these files are
text files with 100+ columns.

For example, I might have a file with 30,000 rows in it, but some columns
don't start having data till row 20,000 or so.

What I would like is a worksheet function where I could give it a range, and
it return the first cell (Index or value) that is not equal to the value in
the first data row.

I'd like to do this without creating extra columns, or having to manually
iterate through thousands of cells for 100+ columns. Functionally, I would
type a formula into a cell above the first column in question, then drag it
across all the other columns so each column would have it's own individual
value for the first different value.

The icing on the cake would be to do the same thing, except this time look
from the bottom up.

Is this possible?

Thanks, Bob
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,268
Default How to find the first row not equal to the value in the first row?

=INDEX(A2:A30000,MATCH(TRUE,A2:A30000<A2,0))

entered with ctrl + shift & enter


will return the contents of the first row in A2:A3000 not equal to A2



--


Regards,


Peo Sjoblom





"INTP56" wrote in message
...
Excel 2003

I often get data files from instruments where many initial rows all have
the
same value, typically zero, but not limited to that. Often these files are
text files with 100+ columns.

For example, I might have a file with 30,000 rows in it, but some columns
don't start having data till row 20,000 or so.

What I would like is a worksheet function where I could give it a range,
and
it return the first cell (Index or value) that is not equal to the value
in
the first data row.

I'd like to do this without creating extra columns, or having to manually
iterate through thousands of cells for 100+ columns. Functionally, I would
type a formula into a cell above the first column in question, then drag
it
across all the other columns so each column would have it's own individual
value for the first different value.

The icing on the cake would be to do the same thing, except this time look
from the bottom up.

Is this possible?

Thanks, Bob



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 66
Default How to find the first row not equal to the value in the first

Thanks Peo, this is exactly the kind of thing I was looking for.

This won't "look up" the array, but just being able to know where I start is
great.

Thanks again,

Bob

"Peo Sjoblom" wrote:

=INDEX(A2:A30000,MATCH(TRUE,A2:A30000<A2,0))

entered with ctrl + shift & enter


will return the contents of the first row in A2:A3000 not equal to A2



--


Regards,


Peo Sjoblom





"INTP56" wrote in message
...
Excel 2003

I often get data files from instruments where many initial rows all have
the
same value, typically zero, but not limited to that. Often these files are
text files with 100+ columns.

For example, I might have a file with 30,000 rows in it, but some columns
don't start having data till row 20,000 or so.

What I would like is a worksheet function where I could give it a range,
and
it return the first cell (Index or value) that is not equal to the value
in
the first data row.

I'd like to do this without creating extra columns, or having to manually
iterate through thousands of cells for 100+ columns. Functionally, I would
type a formula into a cell above the first column in question, then drag
it
across all the other columns so each column would have it's own individual
value for the first different value.

The icing on the cake would be to do the same thing, except this time look
from the bottom up.

Is this possible?

Thanks, Bob




  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,572
Default How to find the first row not equal to the value in the first

With imported data starting in A3, try this *array* formula in A1 for the
*ROW* number of the start of data:

=MIN(IF(A1:A500<A1,ROW(1:500)))

and in A2 for the *ROW* number of the end of data:

=MAX(IF(A1:A500<A500,ROW(1:500)))

--
Array formulas must be entered with CSE, <Ctrl <Shift <Enter, instead of
the regular <Enter, which will *automatically* enclose the formula in curly
brackets, which *cannot* be done manually. Also, you must use CSE when
revising the formula.

--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------


"INTP56" wrote in message
...
Thanks Peo, this is exactly the kind of thing I was looking for.

This won't "look up" the array, but just being able to know where I start
is
great.

Thanks again,

Bob

"Peo Sjoblom" wrote:

=INDEX(A2:A30000,MATCH(TRUE,A2:A30000<A2,0))

entered with ctrl + shift & enter


will return the contents of the first row in A2:A3000 not equal to A2



--


Regards,


Peo Sjoblom





"INTP56" wrote in message
...
Excel 2003

I often get data files from instruments where many initial rows all
have
the
same value, typically zero, but not limited to that. Often these files
are
text files with 100+ columns.

For example, I might have a file with 30,000 rows in it, but some
columns
don't start having data till row 20,000 or so.

What I would like is a worksheet function where I could give it a
range,
and
it return the first cell (Index or value) that is not equal to the
value
in
the first data row.

I'd like to do this without creating extra columns, or having to
manually
iterate through thousands of cells for 100+ columns. Functionally, I
would
type a formula into a cell above the first column in question, then
drag
it
across all the other columns so each column would have it's own
individual
value for the first different value.

The icing on the cake would be to do the same thing, except this time
look
from the bottom up.

Is this possible?

Thanks, Bob






  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,572
Default How to find the first row not equal to the value in the first

Sorry ... WRONG formulas!

Use these:

For start in A1:
=MIN(IF(A3:A500<A3,ROW(3:500)))

For end in A2:
=MAX(IF(A3:A500<A500,ROW(3:500)))

Still *array* formulas.
--
Array formulas must be entered with CSE, <Ctrl <Shift <Enter, instead of
the regular <Enter, which will *automatically* enclose the formula in curly
brackets, which *cannot* be done manually. Also, you must use CSE when
revising the formula.

--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
"RagDyer" wrote in message
...
With imported data starting in A3, try this *array* formula in A1 for the
*ROW* number of the start of data:

=MIN(IF(A1:A500<A1,ROW(1:500)))

and in A2 for the *ROW* number of the end of data:

=MAX(IF(A1:A500<A500,ROW(1:500)))

--
Array formulas must be entered with CSE, <Ctrl <Shift <Enter, instead
of
the regular <Enter, which will *automatically* enclose the formula in
curly
brackets, which *cannot* be done manually. Also, you must use CSE when
revising the formula.

--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------


"INTP56" wrote in message
...
Thanks Peo, this is exactly the kind of thing I was looking for.

This won't "look up" the array, but just being able to know where I start
is
great.

Thanks again,

Bob

"Peo Sjoblom" wrote:

=INDEX(A2:A30000,MATCH(TRUE,A2:A30000<A2,0))

entered with ctrl + shift & enter


will return the contents of the first row in A2:A3000 not equal to A2



--


Regards,


Peo Sjoblom





"INTP56" wrote in message
...
Excel 2003

I often get data files from instruments where many initial rows all
have
the
same value, typically zero, but not limited to that. Often these files
are
text files with 100+ columns.

For example, I might have a file with 30,000 rows in it, but some
columns
don't start having data till row 20,000 or so.

What I would like is a worksheet function where I could give it a
range,
and
it return the first cell (Index or value) that is not equal to the
value
in
the first data row.

I'd like to do this without creating extra columns, or having to
manually
iterate through thousands of cells for 100+ columns. Functionally, I
would
type a formula into a cell above the first column in question, then
drag
it
across all the other columns so each column would have it's own
individual
value for the first different value.

The icing on the cake would be to do the same thing, except this time
look
from the bottom up.

Is this possible?

Thanks, Bob









  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 66
Default How to find the first row not equal to the value in the first

Rag,

At first, I didn't think this was going to work, but after I paid more
attention I realized this was a very clever way to get what I wanted.

Thanks again, another trick for my toolbag!

Bob

"RagDyer" wrote:

Sorry ... WRONG formulas!

Use these:

For start in A1:
=MIN(IF(A3:A500<A3,ROW(3:500)))

For end in A2:
=MAX(IF(A3:A500<A500,ROW(3:500)))

Still *array* formulas.
--
Array formulas must be entered with CSE, <Ctrl <Shift <Enter, instead of
the regular <Enter, which will *automatically* enclose the formula in curly
brackets, which *cannot* be done manually. Also, you must use CSE when
revising the formula.

--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
"RagDyer" wrote in message
...
With imported data starting in A3, try this *array* formula in A1 for the
*ROW* number of the start of data:

=MIN(IF(A1:A500<A1,ROW(1:500)))

and in A2 for the *ROW* number of the end of data:

=MAX(IF(A1:A500<A500,ROW(1:500)))

--
Array formulas must be entered with CSE, <Ctrl <Shift <Enter, instead
of
the regular <Enter, which will *automatically* enclose the formula in
curly
brackets, which *cannot* be done manually. Also, you must use CSE when
revising the formula.

--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------


"INTP56" wrote in message
...
Thanks Peo, this is exactly the kind of thing I was looking for.

This won't "look up" the array, but just being able to know where I start
is
great.

Thanks again,

Bob

"Peo Sjoblom" wrote:

=INDEX(A2:A30000,MATCH(TRUE,A2:A30000<A2,0))

entered with ctrl + shift & enter


will return the contents of the first row in A2:A3000 not equal to A2



--


Regards,


Peo Sjoblom





"INTP56" wrote in message
...
Excel 2003

I often get data files from instruments where many initial rows all
have
the
same value, typically zero, but not limited to that. Often these files
are
text files with 100+ columns.

For example, I might have a file with 30,000 rows in it, but some
columns
don't start having data till row 20,000 or so.

What I would like is a worksheet function where I could give it a
range,
and
it return the first cell (Index or value) that is not equal to the
value
in
the first data row.

I'd like to do this without creating extra columns, or having to
manually
iterate through thousands of cells for 100+ columns. Functionally, I
would
type a formula into a cell above the first column in question, then
drag
it
across all the other columns so each column would have it's own
individual
value for the first different value.

The icing on the cake would be to do the same thing, except this time
look
from the bottom up.

Is this possible?

Thanks, Bob








  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,549
Default How to find the first row not equal to the value in the first row?

Bob,
A user defined function (UDF) is another way.
Place the code below in a standard module.
Enter "=StartValue()" in a row above your data and fill across.
Code follows...
'--
Function StartValue() As String
On Error GoTo BadStart
Dim s As String
Dim rng As Range
Application.Volatile
Set rng = Application.Caller.Offset(1, 0)
Do
s = rng.Text
Set rng = rng(2, 1)
Loop While s = vbNullString

Do Until rng.Text < s
Set rng = rng(2, 1)
Loop
s = rng.Text
If s = vbNullString Then s = "blank"
StartValue = s
Set rng = Nothing
Exit Function
BadStart:
StartValue = "Error " & Err.Number
End Function
--
Jim Cone
Portland, Oregon USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)




"INTP56"
wrote in message
Excel 2003
I often get data files from instruments where many initial rows all have the
same value, typically zero, but not limited to that. Often these files are
text files with 100+ columns.
For example, I might have a file with 30,000 rows in it, but some columns
don't start having data till row 20,000 or so.
What I would like is a worksheet function where I could give it a range, and
it return the first cell (Index or value) that is not equal to the value in
the first data row.
I'd like to do this without creating extra columns, or having to manually
iterate through thousands of cells for 100+ columns. Functionally, I would
type a formula into a cell above the first column in question, then drag it
across all the other columns so each column would have it's own individual
value for the first different value.
The icing on the cake would be to do the same thing, except this time look
from the bottom up.
Is this possible?
Thanks, Bob
  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 66
Default How to find the first row not equal to the value in the first

Jim,

I will probably need to do something like this to look up the columns.

I am always looking for a way to do things without iterating. (Since I'm
more of a database guy, I am used to using sets and not iterating at all.)
When I can't think of a way to avoid iteration, often I read a range into a
variant and iterate through that. It requires managing where I am in the
array vs where that maps to in the worksheet, but is faster than actually
trying to access Cell.Value for many cells.

Thanks for the UDF idea.

Bob


"Jim Cone" wrote:

Bob,
A user defined function (UDF) is another way.
Place the code below in a standard module.
Enter "=StartValue()" in a row above your data and fill across.
Code follows...
'--
Function StartValue() As String
On Error GoTo BadStart
Dim s As String
Dim rng As Range
Application.Volatile
Set rng = Application.Caller.Offset(1, 0)
Do
s = rng.Text
Set rng = rng(2, 1)
Loop While s = vbNullString

Do Until rng.Text < s
Set rng = rng(2, 1)
Loop
s = rng.Text
If s = vbNullString Then s = "blank"
StartValue = s
Set rng = Nothing
Exit Function
BadStart:
StartValue = "Error " & Err.Number
End Function
--
Jim Cone
Portland, Oregon USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)




"INTP56"
wrote in message
Excel 2003
I often get data files from instruments where many initial rows all have the
same value, typically zero, but not limited to that. Often these files are
text files with 100+ columns.
For example, I might have a file with 30,000 rows in it, but some columns
don't start having data till row 20,000 or so.
What I would like is a worksheet function where I could give it a range, and
it return the first cell (Index or value) that is not equal to the value in
the first data row.
I'd like to do this without creating extra columns, or having to manually
iterate through thousands of cells for 100+ columns. Functionally, I would
type a formula into a cell above the first column in question, then drag it
across all the other columns so each column would have it's own individual
value for the first different value.
The icing on the cake would be to do the same thing, except this time look
from the bottom up.
Is this possible?
Thanks, Bob

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 do i find what cells equal a certain number? tdub Excel Discussion (Misc queries) 1 May 14th 08 12:21 AM
find combination of cells that equal a sum Billy Rogers Excel Worksheet Functions 1 February 2nd 08 04:33 AM
Find first cell in a row not equal to John Excel Worksheet Functions 3 December 4th 07 08:13 PM
How to:Find the row of the first cell not equal to several values Vasil Ivanov Excel Worksheet Functions 3 October 2nd 06 02:11 PM
Find combinations of numbers to equal a value jubu Excel Worksheet Functions 1 March 18th 05 12:46 PM


All times are GMT +1. The time now is 05:10 AM.

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"