Lookup Value That Greater Than Zero

fireboltpk

New Member
Joined
May 29, 2017
Messages
9
Hi,

I have a data set with 600 products where I need to pickup the value that is greater than zero. Below is an example of my data set and what I need to pick.

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Product[/TD]
[TD]Price[/TD]
[/TR]
[TR]
[TD]Coke[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]Coke[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]Coke[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]Coke[/TD]
[TD]7[/TD]
[/TR]
[TR]
[TD]Fanta[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]Fanta[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]Fanta[/TD]
[TD]0[/TD]
[/TR]
</tbody>[/TABLE]

What I basically want is that when I do a lookup for Coke and Fanta, my return values are 7 and 5.

Regards,

M
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Heres one way.

=LOOKUP(2,1/(($A$2:$A$8=E1)*($B$2:$B$8>0)),$B$2:$B$8)

Place 'Coke' or 'Fanta' into E1 and your table in A1:B8.
 
Upvote 0
Or………..

=1/LOOKUP(9^9,1/B$2:B$8/(A$2:A$8=E1))

Regards
Bosco
 
Upvote 0
Other possible options.
F1 if you have Office 365
G1 for all versions but this is an array formula so should be entered without the {} but confirmed with Ctrl+Shift+Enter, not just Enter. If confirmed correctly, Excel will insert the {}. The formula can then be copied down.

Excel Workbook
ABCDEFG
1ProductPriceCoke77
2Coke0Fanta55
3Coke0
4Coke0
5Coke7
6Fanta0
7Fanta5
8Fanta0
Max
 
Last edited:
Upvote 0
If you only have one value > 0 for each product, you could use:

=SUMIF(A:A,"Coke",B:B)

for example.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,323
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top