Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 267
Default lookup function??

i have a range which contains a series of values some are numbers some are
text and some are spaces. I want to create a copy of this list further up the
sheet but without the spaces.

I have tried using the lookup function and the lookup function with match
but always have trouble returning both numbers and text.

So I want cell C3 to return the first non empty cells value in range
C50:C150 and C4 to return the second non empty cell in the same range and so
on to a total of 15 values (c18).

any ideas ??
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default lookup function??

Hi,

A UDF perhaps. Alt + F11 to open VB editor. Right click 'This workbook' and
paste the code below in on the right.

Call the code with this in C3

=getrange(C50:C150,ROW(A1))

Drag down.

Function GetRange(rng As Range, instance As Integer)
For Each c In rng
If c.Value < "" Then
instfound = instfound + 1
If instfound = instance Then GetRange = c.Value
End If
Next
If GetRange = "" Then GetRange = "Error"
End Function


Mike


"Atishoo" wrote:

i have a range which contains a series of values some are numbers some are
text and some are spaces. I want to create a copy of this list further up the
sheet but without the spaces.

I have tried using the lookup function and the lookup function with match
but always have trouble returning both numbers and text.

So I want cell C3 to return the first non empty cells value in range
C50:C150 and C4 to return the second non empty cell in the same range and so
on to a total of 15 values (c18).

any ideas ??

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 267
Default lookup function??

seems logical but not working! not sure why??

"Mike H" wrote:

Hi,

A UDF perhaps. Alt + F11 to open VB editor. Right click 'This workbook' and
paste the code below in on the right.

Call the code with this in C3

=getrange(C50:C150,ROW(A1))

Drag down.

Function GetRange(rng As Range, instance As Integer)
For Each c In rng
If c.Value < "" Then
instfound = instfound + 1
If instfound = instance Then GetRange = c.Value
End If
Next
If GetRange = "" Then GetRange = "Error"
End Function


Mike


"Atishoo" wrote:

i have a range which contains a series of values some are numbers some are
text and some are spaces. I want to create a copy of this list further up the
sheet but without the spaces.

I have tried using the lookup function and the lookup function with match
but always have trouble returning both numbers and text.

So I want cell C3 to return the first non empty cells value in range
C50:C150 and C4 to return the second non empty cell in the same range and so
on to a total of 15 values (c18).

any ideas ??

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 combine an IF Function with a lookup function to determine [email protected] Excel Worksheet Functions 1 December 5th 06 06:09 AM
Lookup Function Michael Excel Worksheet Functions 3 July 8th 06 06:50 PM
need help with lookup function wii Excel Worksheet Functions 1 April 28th 06 09:00 PM
Lookup function Srilesh R Excel Worksheet Functions 0 March 13th 06 02:41 PM
Pivot table doing a lookup without using the lookup function? NGASGELI Excel Discussion (Misc queries) 0 August 2nd 05 05:08 AM


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