Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default Formula to find the last number in a series

Hello,

I have the following list of number and need to find the last number that
starts with 1006? How do I do that? Also if I search for numbers beginning
with 1008 I need to know that there is none present.

1005001
1005002
1006001
1006002
1006003
1007001
1007002

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Formula to find the last number in a series

Maybe this:

=LOOKUP(2,1/(LEFT(A1:A7,4)="1006"),A1:A7)

Also if I search for numbers beginning with 1008
I need to know that there is none present.


The above formula will return #N/A.


--
Biff
Microsoft Excel MVP


"OX_Gambit" wrote in message
...
Hello,

I have the following list of number and need to find the last number that
starts with 1006? How do I do that? Also if I search for numbers
beginning
with 1008 I need to know that there is none present.

1005001
1005002
1006001
1006002
1006003
1007001
1007002



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default Formula to find the last number in a series

What if the list of numbers are numbers not text?

"T. Valko" wrote:

Maybe this:

=LOOKUP(2,1/(LEFT(A1:A7,4)="1006"),A1:A7)

Also if I search for numbers beginning with 1008
I need to know that there is none present.


The above formula will return #N/A.


--
Biff
Microsoft Excel MVP


"OX_Gambit" wrote in message
...
Hello,

I have the following list of number and need to find the last number that
starts with 1006? How do I do that? Also if I search for numbers
beginning
with 1008 I need to know that there is none present.

1005001
1005002
1006001
1006002
1006003
1007001
1007002




  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,231
Default Formula to find the last number in a series

OX_Gambit wrote...
What if the list of numbers are numbers not text?


Did you try the formula before deciding it couldn't work?

"T. Valko" wrote:

....
=LOOKUP(2,1/(LEFT(A1:A7,4)="1006"),A1:A7)

....
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default Formula to find the last number in a series

What does the 1/(LEFT(A1:A7,4) do to the text?

"T. Valko" wrote:

Maybe this:

=LOOKUP(2,1/(LEFT(A1:A7,4)="1006"),A1:A7)

Also if I search for numbers beginning with 1008
I need to know that there is none present.


The above formula will return #N/A.


--
Biff
Microsoft Excel MVP


"OX_Gambit" wrote in message
...
Hello,

I have the following list of number and need to find the last number that
starts with 1006? How do I do that? Also if I search for numbers
beginning
with 1008 I need to know that there is none present.

1005001
1005002
1006001
1006002
1006003
1007001
1007002






  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,231
Default Formula to find the last number in a series

OX_Gambit wrote...
What does the 1/(LEFT(A1:A7,4) do to the text?

....

Unless Transition Formula Evaluation is enabled (it's disabled by
default), Excel converts numbers to text when used in text contexts,
such as when ranges are processed by the LEFT function. LEFT(range,4)
returns an array of the leftmost 4 characters from each cell in range.
In your case that would mean returning the leftmost 4 numerals as a
string. The entire expression actually was

1/(LEFT(A1:A7,4)="1006")

in which the leftmost 4 numerals in each cell in A1:A7 is compared to
"1006", the 4 digits you've said you're seeking. The result is an
array of TRUE (match) or FALSE (don't match) values. Next, Excel
converts TRUE to 1 and FALSE to 0 when they're used in arithmetic
contexts such as dividing them into 1. The entire expression will then
return an array of 1s (1/TRUE = 1/1 = 1) or #DIV/0! (1/FALSE = 1/0 =
#DIV/0!). The rest of the formula uses a quirk of Excel LOOKUP
function in which it will seek through it's entire 2nd argument to
find the first value greater than its 1st argument. It also keeps
track of the last value in its 2nd argument less than its 1st
argument. Since the 2nd argument would contain only 1 and #DIV/0!, it
won't find 2. It skips the #DIV/0! values, and it keeps track of the
last 1 found. When it runs through the 2nd argument array without
finding a 2, it uses the last 1 found as the match. That means it
matches the last cell in A1:A7 that begins with the ordered numerals
1006.
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,124
Default Formula to find the last number in a series

Numbers in col J
=SUMPRODUCT((LEFT(TRIM($J$2:$J$22),4)="1006")*1)
if numbers in col L
=SUMPRODUCT((LEFT(TRIM($J$2:$J$22),4)=TEXT(L4,"000 0"))*1)
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"OX_Gambit" wrote in message
...
Hello,

I have the following list of number and need to find the last number that
starts with 1006? How do I do that? Also if I search for numbers
beginning
with 1008 I need to know that there is none present.

1005001
1005002
1006001
1006002
1006003
1007001
1007002


  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,393
Default Formula to find the last number in a series

Q1: use formula
=INDEX(A1:A10,MAX(IF(INT((A1:A10)/1000)=1006,ROW(A1:A10),0)))
As this is an array formula, commit it with CTRL+SHIFT+ENTER (not just
ENTER)
Change A1:A100 to suit your needs, for not use full column reference like
A:A unless you have Excel 2007

Q2: use array formula
=IF(MAX(IF(INT((A1:A10)/1000)=1008,ROW(A1:A10),0)),"found","not found")

best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"OX_Gambit" wrote in message
...
Hello,

I have the following list of number and need to find the last number that
starts with 1006? How do I do that? Also if I search for numbers
beginning
with 1008 I need to know that there is none present.

1005001
1005002
1006001
1006002
1006003
1007001
1007002




  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,240
Default Formula to find the last number in a series

OX_Gambit wrote:
Hello,

I have the following list of number and need to find the last number that
starts with 1006? How do I do that? Also if I search for numbers beginning
with 1008 I need to know that there is none present.

1005001
1005002
1006001
1006002
1006003
1007001
1007002


If, by "last number" you mean the highest number and they may not be sorted
ascending, try this array-entered formula:

=MAX((LEFT(A1:A7,4)="1006")*A1:A7)

This formula will result in 0 for "beginning with 1008" with your data.
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 number within data by formula capital letter Excel Worksheet Functions 1 November 7th 07 01:14 PM
find a number within data by formula capital letter Excel Worksheet Functions 1 November 7th 07 01:10 PM
countif formula to find the occurances of a number that is greater than one number but less than another steveo Excel Discussion (Misc queries) 3 July 8th 06 02:04 AM
how can we find out any missed number in a series? Excel Excel Discussion (Misc queries) 4 May 17th 06 04:57 PM
how we can find out any missed number in a series? Excel Excel Discussion (Misc queries) 1 May 17th 06 04:26 PM


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