# Excel - vlookup for max value or any value>0

Asked By JBEmpire on 13-May-10 04:05 PM
```I have one sheet with product id, length, material, index and unit/length
price for multiple stores for a given market. I am trying to generate a new
sheet with proposed product id, new length and total cost based on the unit
length and product id of the current sheet. Each product could have multiple
unit/length prices at each store or none at all. My main objective is to get
a none zero cost for the stores that currently have at least one unit price.
Can I use vlookup to search the index and return with the first or max none
zero corresponding unit cost for store 1,2,3,.....? My current formula
returns with the first match whether it is a price or a blank. So for
tube1steel store 1, my value is blank and not 1.50 as in store 2.

Prod   lngth Mat    Index        Store  Store   Store
1        2        3

tube1  1.0  steel   tube1steel            1.50
tube1  1.8  steel   tube1steel   1.50   1.50
tube2  1.8  steel   tube2steel   1.25            1.30
tube1  2.4  steel   tube1steel   1.45   1.50   1.50
tube2  2.4  steel   tube2steel            1.35

Actual formula below. The * represents where the item was present, but did
not have pricing. A blank is present when the item was not present.

=IF(VLOOKUP(\$J5,'All Dowels price per
length'!\$G\$2:\$AS\$94,3,FALSE)="*","*",IF(VLOOKUP(\$J5,'All Dowels price per
length'!\$G\$2:\$AS\$94,3,FALSE)="","",VLOOKUP(\$J5,'All Dowels price per
length'!\$G\$2:\$AS\$94,3,FALSE)*\$D5))

Any help would be appreciated.```

Brad replied to JBEmpire on 14-May-10 09:43 AM
```I would have a helper column after Store 3 with the formula below...

=IF(COUNT(E7:G7),INDEX(E7:G7,MATCH(TRUE,INDEX(E7:G7<>"",0),0)),"")

(this assumes that the first row of row of information is in column 7
(and store 1 is in column E, store 2 is in column F, store3 is in column G

--
Wag more, bark less```