Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 577
Default Selecting last five numbers in a selection

I have a series of data in the same row, (F5:AC5) containing anywhere from 1
to 24 numbers. In cells AD5:AH5, I want to determine the LAST five numbers
entered in the row of data (not smallest or largest, but simply the last
numbers that were entered in). There could be duplicate numbers, and blanks
in between cells of numbers. How would I go about this?

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Selecting last five numbers in a selection

try this idea
Sub lastfivenums()
mr = 5
For i = Cells(mr, Columns.Count).End(xlToLeft).Column To 6 Step -1
If Cells(mr, i) 0 Then
ms = ms + Cells(mr, i)
mc = mc + 1
If mc = 5 Then Exit For
End If
Next i
MsgBox ms
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Scott" wrote in message
...
I have a series of data in the same row, (F5:AC5) containing anywhere from
1
to 24 numbers. In cells AD5:AH5, I want to determine the LAST five
numbers
entered in the row of data (not smallest or largest, but simply the last
numbers that were entered in). There could be duplicate numbers, and
blanks
in between cells of numbers. How would I go about this?

Thanks.


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 577
Default Selecting last five numbers in a selection

Will anything other than a macro work?

"Don Guillett" wrote:

try this idea
Sub lastfivenums()
mr = 5
For i = Cells(mr, Columns.Count).End(xlToLeft).Column To 6 Step -1
If Cells(mr, i) 0 Then
ms = ms + Cells(mr, i)
mc = mc + 1
If mc = 5 Then Exit For
End If
Next i
MsgBox ms
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Scott" wrote in message
...
I have a series of data in the same row, (F5:AC5) containing anywhere from
1
to 24 numbers. In cells AD5:AH5, I want to determine the LAST five
numbers
entered in the row of data (not smallest or largest, but simply the last
numbers that were entered in). There could be duplicate numbers, and
blanks
in between cells of numbers. How would I go about this?

Thanks.



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default Selecting last five numbers in a selection

What should happen if there aren't 5 numbers?

--
Biff
Microsoft Excel MVP


"Scott" wrote in message
...
Will anything other than a macro work?

"Don Guillett" wrote:

try this idea
Sub lastfivenums()
mr = 5
For i = Cells(mr, Columns.Count).End(xlToLeft).Column To 6 Step -1
If Cells(mr, i) 0 Then
ms = ms + Cells(mr, i)
mc = mc + 1
If mc = 5 Then Exit For
End If
Next i
MsgBox ms
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Scott" wrote in message
...
I have a series of data in the same row, (F5:AC5) containing anywhere
from
1
to 24 numbers. In cells AD5:AH5, I want to determine the LAST five
numbers
entered in the row of data (not smallest or largest, but simply the
last
numbers that were entered in). There could be duplicate numbers, and
blanks
in between cells of numbers. How would I go about this?

Thanks.





  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 577
Default Selecting last five numbers in a selection

I would want it to return the numbers up to five numbers. So if there were
only three number for instance in the data set, I'd want to return all three.

"T. Valko" wrote:

What should happen if there aren't 5 numbers?

--
Biff
Microsoft Excel MVP


"Scott" wrote in message
...
Will anything other than a macro work?

"Don Guillett" wrote:

try this idea
Sub lastfivenums()
mr = 5
For i = Cells(mr, Columns.Count).End(xlToLeft).Column To 6 Step -1
If Cells(mr, i) 0 Then
ms = ms + Cells(mr, i)
mc = mc + 1
If mc = 5 Then Exit For
End If
Next i
MsgBox ms
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Scott" wrote in message
...
I have a series of data in the same row, (F5:AC5) containing anywhere
from
1
to 24 numbers. In cells AD5:AH5, I want to determine the LAST five
numbers
entered in the row of data (not smallest or largest, but simply the
last
numbers that were entered in). There could be duplicate numbers, and
blanks
in between cells of numbers. How would I go about this?

Thanks.







  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default Selecting last five numbers in a selection

Try this array formula** entered in AD5 and copied across to AH5:

=IF(COLUMNS($AD5:AD5)<=COUNT($F5:$AC5),INDEX($F5:$ AC5,LARGE(IF($F5:$AC5<"",COLUMN($F5:$AC5)),COLUMN S($AD5:AD5))-COLUMN($F5)+1),"")

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT
key then hit ENTER.

--
Biff
Microsoft Excel MVP


"Scott" wrote in message
...
I would want it to return the numbers up to five numbers. So if there were
only three number for instance in the data set, I'd want to return all
three.

"T. Valko" wrote:

What should happen if there aren't 5 numbers?

--
Biff
Microsoft Excel MVP


"Scott" wrote in message
...
Will anything other than a macro work?

"Don Guillett" wrote:

try this idea
Sub lastfivenums()
mr = 5
For i = Cells(mr, Columns.Count).End(xlToLeft).Column To 6 Step -1
If Cells(mr, i) 0 Then
ms = ms + Cells(mr, i)
mc = mc + 1
If mc = 5 Then Exit For
End If
Next i
MsgBox ms
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Scott" wrote in message
...
I have a series of data in the same row, (F5:AC5) containing anywhere
from
1
to 24 numbers. In cells AD5:AH5, I want to determine the LAST five
numbers
entered in the row of data (not smallest or largest, but simply the
last
numbers that were entered in). There could be duplicate numbers,
and
blanks
in between cells of numbers. How would I go about this?

Thanks.







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
Excel 2007: Selecting multiple objects by drawing a selection box panalysis Excel Discussion (Misc queries) 4 April 2nd 23 07:41 PM
Selecting specific numbers from a cell containing multiple numbers JRD Excel Worksheet Functions 3 January 18th 09 12:32 AM
Selecting a cell entry based on cell validation selection Brutalius Excel Worksheet Functions 2 December 17th 08 03:44 AM
how to set shading color of selection when i am selecting cells? N.A. Kamka Setting up and Configuration of Excel 0 May 7th 08 05:14 AM
Selecting Multiple Columns in a Named Selection Griffithpt Excel Worksheet Functions 0 August 9th 06 10:54 PM


All times are GMT +1. The time now is 06:03 AM.

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"