View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Charabeuh[_4_] Charabeuh[_4_] is offline
external usenet poster
 
Posts: 62
Default Quickest way to find a row number a value

Hello,

with an array formula (use Ctrl+Alt+Enter instead of Enter to validate the
formula)
=INDEX($B:$B,MIN(IF($A$1:$A$7="DEK S01",
IF($B$1:$B$70,ROW($A$1:$A$7),10000000),10000000)) )


$A$1:$A$7 is the first column of your data
"DEK S01" is the string you to be searched
$B$1:$B$7 is the second column of your data

The formula return an error #REF! if no values are 0






"DG" a écrit dans le message de
...
I have a spreadsheet as follows:

column A column B
DEK S01 0
DEK S01 300
DEK S01 400
DEK S01 450
LIC G13 25
LIC G13 50
LIC G14 100
etc...

I am trying to write a function to return the first non-zero value in
column B of the Item in column A. So when I call the function
Get_Cost("DEK S01") it will return 300. When I call Get_Cost("LIC G13")
it will return 25.

A quick way of getting the row number for LIC G13 would be a help, so I
don't have to loop so much.

DG