Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 266
Default Find the last cell in a column which contains "-"

I have a column of values that contain text like XX-YY, ZZZ-DD4, etc. I want
to find the last row of the column that has a "-". Is there a function I can
use to find this (maybe SUMPRODUCT ?). Thanks for any help with this.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 265
Default Find the last cell in a column which contains "-"

To return the last value containing "-", try...

=LOOKUP(9.99999999999999E+307,FIND("-",A2:A100),A2:A100)

--
Domenic
Microsoft Excel MVP
www.xl-central.com
Your Quick Reference to Excel Solutions

In article ,
dhstein wrote:

I have a column of values that contain text like XX-YY, ZZZ-DD4, etc. I want
to find the last row of the column that has a "-". Is there a function I can
use to find this (maybe SUMPRODUCT ?). Thanks for any help with this.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,718
Default Find the last cell in a column which contains "-"

=LOOKUP(2,1/(ISNUMBER(FIND("-",A:A))),A:A)


"dhstein" wrote:

I have a column of values that contain text like XX-YY, ZZZ-DD4, etc. I want
to find the last row of the column that has a "-". Is there a function I can
use to find this (maybe SUMPRODUCT ?). Thanks for any help with this.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 266
Default Find the last cell in a column which contains "-"

Thanks teethless and Domenic. That's great - but I don't want the value - I
want the row number. How could I get that ?



"Teethless mama" wrote:

=LOOKUP(2,1/(ISNUMBER(FIND("-",A:A))),A:A)


"dhstein" wrote:

I have a column of values that contain text like XX-YY, ZZZ-DD4, etc. I want
to find the last row of the column that has a "-". Is there a function I can
use to find this (maybe SUMPRODUCT ?). Thanks for any help with this.

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 266
Default Find the last cell in a column which contains "-"

Thanks - used "MATCH" function and your function to get the last row - thanks
again



"Teethless mama" wrote:

=LOOKUP(2,1/(ISNUMBER(FIND("-",A:A))),A:A)


"dhstein" wrote:

I have a column of values that contain text like XX-YY, ZZZ-DD4, etc. I want
to find the last row of the column that has a "-". Is there a function I can
use to find this (maybe SUMPRODUCT ?). Thanks for any help with this.



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,718
Default Find the last cell in a column which contains "-"

You're Welcome!


"dhstein" wrote:

Thanks - used "MATCH" function and your function to get the last row - thanks
again



"Teethless mama" wrote:

=LOOKUP(2,1/(ISNUMBER(FIND("-",A:A))),A:A)


"dhstein" wrote:

I have a column of values that contain text like XX-YY, ZZZ-DD4, etc. I want
to find the last row of the column that has a "-". Is there a function I can
use to find this (maybe SUMPRODUCT ?). Thanks for any help with this.

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 265
Default Find the last cell in a column which contains "-"

Try...

=LOOKUP(9.99999999999999E+307,FIND("-",A2:A100),ROW(A2:A100))

--
Domenic
Microsoft Excel MVP
www.xl-central.com
Your Quick Reference to Excel Solutions

In article ,
dhstein wrote:

Thanks teethless and Domenic. That's great - but I don't want the value - I
want the row number. How could I get that ?



"Teethless mama" wrote:

=LOOKUP(2,1/(ISNUMBER(FIND("-",A:A))),A:A)


"dhstein" wrote:

I have a column of values that contain text like XX-YY, ZZZ-DD4, etc. I
want
to find the last row of the column that has a "-". Is there a function I
can
use to find this (maybe SUMPRODUCT ?). Thanks for any help with this.

  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default Find the last cell in a column which contains "-"

=LOOKUP(2,1/(ISNUMBER(FIND("-",A:A))),A:A)

No need for the ISNUMBER function. You can't reference the entire column in
the FIND function if you're using a version of Excel prior to Excel 2007.

--
Biff
Microsoft Excel MVP


"Teethless mama" wrote in message
...
=LOOKUP(2,1/(ISNUMBER(FIND("-",A:A))),A:A)


"dhstein" wrote:

I have a column of values that contain text like XX-YY, ZZZ-DD4, etc. I
want
to find the last row of the column that has a "-". Is there a function I
can
use to find this (maybe SUMPRODUCT ?). Thanks for any help with this.



  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 266
Default Find the last cell in a column which contains "-"


Thanks for this information. I thought I knew every Excel function - but
Lookup was new to me. I tried to read the examples, but I'm not clear how
this LOOKUP function is working - I even did "evaluate function" - but still
not sure. What is the "1/" . I assume somehow we're getting errors of
divide by zero when FIND is not found. I would appreciate it if one of you
could explain it a little. Thanks.

David

"T. Valko" wrote:

=LOOKUP(2,1/(ISNUMBER(FIND("-",A:A))),A:A)


No need for the ISNUMBER function. You can't reference the entire column in
the FIND function if you're using a version of Excel prior to Excel 2007.

--
Biff
Microsoft Excel MVP


"Teethless mama" wrote in message
...
=LOOKUP(2,1/(ISNUMBER(FIND("-",A:A))),A:A)


"dhstein" wrote:

I have a column of values that contain text like XX-YY, ZZZ-DD4, etc. I
want
to find the last row of the column that has a "-". Is there a function I
can
use to find this (maybe SUMPRODUCT ?). Thanks for any help with this.




  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default Find the last cell in a column which contains "-"

What is the "1/" . I assume somehow we're getting
errors of divide by zero when FIND is not found.


Yes, that is correct depending on which version of the formula you use. If
you use the 1/ISNUMBER version then you'll get #DIV/0! errors. If you use
the 1/FIND version then you'll get #VALUE! errors.

Here's how it works...

...........A.....
1....xx-xx
2...10
3...aa-bb
4...yes-no
5...dddd

=LOOKUP(2,1/FIND("-",A1:A5),A1:A5)

Result = yes-no

FIND returns the starting position of the character we're looking for in the
string. If the character is not found then the result is the error #VALUE!.

FIND("-",A1:A5)

FIND("-",A1) = 3 (the dash is found at the 3rd character)
FIND("-",A2) = #VALUE! (the dash is not found)
FIND("-",A3) = 3 (the dash is found at the 3rd character)
FIND("-",A4) = 4 (the dash is found at the 4th character)
FIND("-",A5) = #VALUE! (the dash is not found)

Each of these results is then divided:

1/FIND("-",A1:A5)

1/3 = 0.333
1/#VALUE! = #VALUE!
1/3 = 0.333
1/4 = 0.250
1/#VALUE! = #VALUE!

The way that LOOKUP works is if the lookup_value 2 is greater than all the
values in the lookup_vector it will match the *last* value in the
lookup_vector that is less than the lookup_value 2.

The *last* value in the lookup_vector that is less than the lookup_value 2
is
0.250. The #VALUE!! errors are ignored. We use a lookup_value of 2
because we know that the result of this expression:

1/FIND("-",A1:A5)

will not return a value greater than 1 thus ensuring that the lookup_value 2
is guaranteed to be greater than any value in the lookup_vector.

The final result of the formula is the value in the result_vector A1:A5 that
corresponds to the *last* value in the lookup_vector that is less than 2.

Lookup_vector...Result_vector
.......0.333................xx-xx
....#VALUE!............10
.......0.333................aa-bb
.......0.250................yes-no
....#VALUE!............dddd

So:

=LOOKUP(2,1/FIND("-",A1:A5),A1:A5)

Result = yes-no



exp101
--
Biff
Microsoft Excel MVP


"dhstein" wrote in message
...

Thanks for this information. I thought I knew every Excel function - but
Lookup was new to me. I tried to read the examples, but I'm not clear how
this LOOKUP function is working - I even did "evaluate function" - but
still
not sure. What is the "1/" . I assume somehow we're getting errors of
divide by zero when FIND is not found. I would appreciate it if one of
you
could explain it a little. Thanks.

David

"T. Valko" wrote:

=LOOKUP(2,1/(ISNUMBER(FIND("-",A:A))),A:A)


No need for the ISNUMBER function. You can't reference the entire column
in
the FIND function if you're using a version of Excel prior to Excel 2007.

--
Biff
Microsoft Excel MVP


"Teethless mama" wrote in
message
...
=LOOKUP(2,1/(ISNUMBER(FIND("-",A:A))),A:A)


"dhstein" wrote:

I have a column of values that contain text like XX-YY, ZZZ-DD4, etc.
I
want
to find the last row of the column that has a "-". Is there a
function I
can
use to find this (maybe SUMPRODUCT ?). Thanks for any help with
this.








  #11   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 266
Default Find the last cell in a column which contains "-"

Biff,

Thanks for taking the time to explain this.

David


"T. Valko" wrote:

What is the "1/" . I assume somehow we're getting
errors of divide by zero when FIND is not found.


Yes, that is correct depending on which version of the formula you use. If
you use the 1/ISNUMBER version then you'll get #DIV/0! errors. If you use
the 1/FIND version then you'll get #VALUE! errors.

Here's how it works...

...........A.....
1....xx-xx
2...10
3...aa-bb
4...yes-no
5...dddd

=LOOKUP(2,1/FIND("-",A1:A5),A1:A5)

Result = yes-no

FIND returns the starting position of the character we're looking for in the
string. If the character is not found then the result is the error #VALUE!.

FIND("-",A1:A5)

FIND("-",A1) = 3 (the dash is found at the 3rd character)
FIND("-",A2) = #VALUE! (the dash is not found)
FIND("-",A3) = 3 (the dash is found at the 3rd character)
FIND("-",A4) = 4 (the dash is found at the 4th character)
FIND("-",A5) = #VALUE! (the dash is not found)

Each of these results is then divided:

1/FIND("-",A1:A5)

1/3 = 0.333
1/#VALUE! = #VALUE!
1/3 = 0.333
1/4 = 0.250
1/#VALUE! = #VALUE!

The way that LOOKUP works is if the lookup_value 2 is greater than all the
values in the lookup_vector it will match the *last* value in the
lookup_vector that is less than the lookup_value 2.

The *last* value in the lookup_vector that is less than the lookup_value 2
is
0.250. The #VALUE!! errors are ignored. We use a lookup_value of 2
because we know that the result of this expression:

1/FIND("-",A1:A5)

will not return a value greater than 1 thus ensuring that the lookup_value 2
is guaranteed to be greater than any value in the lookup_vector.

The final result of the formula is the value in the result_vector A1:A5 that
corresponds to the *last* value in the lookup_vector that is less than 2.

Lookup_vector...Result_vector
.......0.333................xx-xx
....#VALUE!............10
.......0.333................aa-bb
.......0.250................yes-no
....#VALUE!............dddd

So:

=LOOKUP(2,1/FIND("-",A1:A5),A1:A5)

Result = yes-no



exp101
--
Biff
Microsoft Excel MVP


"dhstein" wrote in message
...

Thanks for this information. I thought I knew every Excel function - but
Lookup was new to me. I tried to read the examples, but I'm not clear how
this LOOKUP function is working - I even did "evaluate function" - but
still
not sure. What is the "1/" . I assume somehow we're getting errors of
divide by zero when FIND is not found. I would appreciate it if one of
you
could explain it a little. Thanks.

David

"T. Valko" wrote:

=LOOKUP(2,1/(ISNUMBER(FIND("-",A:A))),A:A)

No need for the ISNUMBER function. You can't reference the entire column
in
the FIND function if you're using a version of Excel prior to Excel 2007.

--
Biff
Microsoft Excel MVP


"Teethless mama" wrote in
message
...
=LOOKUP(2,1/(ISNUMBER(FIND("-",A:A))),A:A)


"dhstein" wrote:

I have a column of values that contain text like XX-YY, ZZZ-DD4, etc.
I
want
to find the last row of the column that has a "-". Is there a
function I
can
use to find this (maybe SUMPRODUCT ?). Thanks for any help with
this.






  #12   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default Find the last cell in a column which contains "-"

You're welcome!

--
Biff
Microsoft Excel MVP


"dhstein" wrote in message
...
Biff,

Thanks for taking the time to explain this.

David


"T. Valko" wrote:

What is the "1/" . I assume somehow we're getting
errors of divide by zero when FIND is not found.


Yes, that is correct depending on which version of the formula you use.
If
you use the 1/ISNUMBER version then you'll get #DIV/0! errors. If you use
the 1/FIND version then you'll get #VALUE! errors.

Here's how it works...

...........A.....
1....xx-xx
2...10
3...aa-bb
4...yes-no
5...dddd

=LOOKUP(2,1/FIND("-",A1:A5),A1:A5)

Result = yes-no

FIND returns the starting position of the character we're looking for in
the
string. If the character is not found then the result is the error
#VALUE!.

FIND("-",A1:A5)

FIND("-",A1) = 3 (the dash is found at the 3rd character)
FIND("-",A2) = #VALUE! (the dash is not found)
FIND("-",A3) = 3 (the dash is found at the 3rd character)
FIND("-",A4) = 4 (the dash is found at the 4th character)
FIND("-",A5) = #VALUE! (the dash is not found)

Each of these results is then divided:

1/FIND("-",A1:A5)

1/3 = 0.333
1/#VALUE! = #VALUE!
1/3 = 0.333
1/4 = 0.250
1/#VALUE! = #VALUE!

The way that LOOKUP works is if the lookup_value 2 is greater than all
the
values in the lookup_vector it will match the *last* value in the
lookup_vector that is less than the lookup_value 2.

The *last* value in the lookup_vector that is less than the lookup_value
2
is
0.250. The #VALUE!! errors are ignored. We use a lookup_value of 2
because we know that the result of this expression:

1/FIND("-",A1:A5)

will not return a value greater than 1 thus ensuring that the
lookup_value 2
is guaranteed to be greater than any value in the lookup_vector.

The final result of the formula is the value in the result_vector A1:A5
that
corresponds to the *last* value in the lookup_vector that is less than 2.

Lookup_vector...Result_vector
.......0.333................xx-xx
....#VALUE!............10
.......0.333................aa-bb
.......0.250................yes-no
....#VALUE!............dddd

So:

=LOOKUP(2,1/FIND("-",A1:A5),A1:A5)

Result = yes-no



exp101
--
Biff
Microsoft Excel MVP


"dhstein" wrote in message
...

Thanks for this information. I thought I knew every Excel function -
but
Lookup was new to me. I tried to read the examples, but I'm not clear
how
this LOOKUP function is working - I even did "evaluate function" - but
still
not sure. What is the "1/" . I assume somehow we're getting errors of
divide by zero when FIND is not found. I would appreciate it if one of
you
could explain it a little. Thanks.

David

"T. Valko" wrote:

=LOOKUP(2,1/(ISNUMBER(FIND("-",A:A))),A:A)

No need for the ISNUMBER function. You can't reference the entire
column
in
the FIND function if you're using a version of Excel prior to Excel
2007.

--
Biff
Microsoft Excel MVP


"Teethless mama" wrote in
message
...
=LOOKUP(2,1/(ISNUMBER(FIND("-",A:A))),A:A)


"dhstein" wrote:

I have a column of values that contain text like XX-YY, ZZZ-DD4,
etc.
I
want
to find the last row of the column that has a "-". Is there a
function I
can
use to find this (maybe SUMPRODUCT ?). Thanks for any help with
this.








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
"Find" a wildcard as a place marker and "replace" with original va Eric Excel Discussion (Misc queries) 1 January 27th 09 06:00 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
keyboard shortcut to return to previous cell after "find" or "got. Nadavb New Users to Excel 1 May 25th 08 01:39 AM
How do I change the column heading in Excel to display "A" "B" "C Thai New Users to Excel 1 November 30th 07 08:06 PM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM


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