#1   Report Post  
Posted to microsoft.public.excel.misc
Ken Ken is offline
external usenet poster
 
Posts: 590
Default Offset???

Excel2003 ...

Col E ... Contains: Empty Cells, "A" & "I"
Col W ... Contains: Empty Cells & "Qty's"

I wish to return the "Qty" from Col "W" from the 1st record that contains an
Empty Cell above the "I" in Col E.

Issue is: I can have several records in a row with the "I" indicator & I
still wish to return the "Qty" from Col "W" from the 1st record above the
"I's" that contain an Empth Cell.

ie:

Col E Col W
Ind Qty
-- 10
-- 3
A --
-- 10
-- 7
-- 10*
I 3 ... Return 10*
-- 20
-- 20
-- 20*
I 10 ... Return 20*
I 10 ... Return 20*
I 5 ... Return 20*
I 5 ... Return 20*
-- 10
-- 10

Thanks ... Kha
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Function

Ken,

Following is a UDF that should work. Insert a blank module in your workbook
and copy in the following code:

Public Function aboveI(rngI As Range, rngNum As Range) As Variant

If rngI.Value < "i" Then
aboveI = ""
Exit Function
End If

Do Until rngI.Value < "i"
Set rngI = rngI.Offset(-1)
Loop

aboveI = rngI.Parent.Cells(rngI.Row, rngNum.Column).Value

End Function

Regards,
Eddie
HelpExcel.com
  #3   Report Post  
Posted to microsoft.public.excel.misc
Ken Ken is offline
external usenet poster
 
Posts: 590
Default Function

Eddie ... (Hi)

Code copied into new Module ... However, I do not know how to write against
the new Function (abovei) ... =abovei(?????) ... "I" codes are in Col E & I
need to return "Qty" from Col "W".

Thanks ... Kha

"HelpExcel.com" wrote:

Ken,

Following is a UDF that should work. Insert a blank module in your workbook
and copy in the following code:

Public Function aboveI(rngI As Range, rngNum As Range) As Variant

If rngI.Value < "i" Then
aboveI = ""
Exit Function
End If

Do Until rngI.Value < "i"
Set rngI = rngI.Offset(-1)
Loop

aboveI = rngI.Parent.Cells(rngI.Row, rngNum.Column).Value

End Function

Regards,
Eddie
HelpExcel.com

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
Compare Cell Values, Offset(-1,0), Offset(-1,-1), and xlFillDefaul RyGuy Excel Worksheet Functions 2 September 28th 07 10:54 PM
offset Eva Excel Worksheet Functions 2 January 29th 07 08:45 PM
OFFSET HELP Scott@CW Excel Worksheet Functions 1 December 21st 06 04:27 AM
VBA help with Offset gjcase Excel Discussion (Misc queries) 3 July 13th 06 02:35 PM
Max Offset Voodoodan Excel Discussion (Misc queries) 19 May 26th 05 11:47 AM


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