Complex Excel Formula

Pori96

New Member
Joined
Apr 15, 2020
Messages
10
Platform
  1. Windows
Hello friends.

I'm struggling with a formula and I was wondering if you could help me with it. I'm trying to match the value of a cell with the heading of a column and the value that I want to show is in the same row where I wrote the formula. The formula works but the problem is that in some cases the cell is empty so it gives me the first value it finds. I need to locate a value that is greater than 0 but also the minimum value that matches the cell with the heading.

Let me show you what I have so far and thank you in advance.
1586985462635.png

Where should I add the min formula and the if greater than 0 ?
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
I want to ble able to match the G column with a similar value that matches the heading and delivers the lowest price that is greater than 0 (there are many more columns with different MOQs on the left and on the right but some are blank so as you can see I get 0)
1586985763172.png
1586985907360.png
 
Upvote 0
Could you use the XL2BB tool and give a copy-able format of your data? The XL2BB tool can be seen just at the right side of the post window setting. I have highlighted the same in the below picture.
1586988200897.png


Also, you have written that there are some blanks on the left and right. If not your actual, then could you give a small sample of your data with the desired output, so that we can clearly see what you want?
You haven't given a output that you desire in the above posts.
 
Upvote 0
Thanks for replying.

Basically I work in a manufacturing company. We have different suppliers and each supplier has a different price based on the MOQ (Minimum order quantity)
In a blank cell I want to write the demand for that month and with this formula I want to locate the best price for that demand.

Example:

This month I have a demand of 50,000 parts (column G).
1586989810945.png

As you can see some of my suppliers don't have a price for that item because they don't sell it.
1586990065382.png

But supplier 2 offers that item and it has different prices depending on the MOQ
1586990144780.png

Let's say that in this case I only have 2 suppliers and as you can see the price per item for an MOQ of 50,000 is $0.0065
1586990249450.png


I want that number to appear on the column H because that's the best price for the demand I currently have.



Sorry I couldn't install the plug in. My computer blocks it but I hope this helps you with what I want to know.

Thank you for your support.
 
Upvote 0
Assuming that the quantity in G47 will always be equal to one of the quantities in R47:BT47, then you could try

Excel 2019 (or newer, including office 365)
=MINIFS($R$3:$BT$3,$R$3:$BT$3,">0",R47:BT47,G47)

Excel 2010 - 2016
=AGGREGATE(15,6,(R47:BT47=G47)/(1/$R$3:$BT$3),1)

That's as good as it gets when there are only screen captures to work with.
 
Upvote 0
Maybe something like this:
Change ranges to match your data.

Book1
BCDEFGHI
11000200030005000800010000
250000.04390.09810.17210.05000.11090.06180.1019
30.06860.06520.12660.05340.13450.1173
40.05090.09310.08320.00000.15660.1047
50.15000.08700.04010.09700.0795
60.09780.11690.16820.04390.16590.1083
Sheet1
Cell Formulas
RangeFormula
C2C2=MINIFS(INDEX($D$2:$I$6,0,MATCH($B$2,$D$1:$I$1)),INDEX($D$2:$I$6,0,MATCH($B$2,$D$1:$I$1)),">0")
 
Upvote 0
Thanks but the result is still 0
Taking another look I think that I got the ranges reversed. Remember that the formulas assume that the quantity in G47 will always be equal to one of the quantities in R3:BT3, if the quantity is not an exact match then it will need a different approach. We can only work with the information you give us.

=MINIFS(R47:BT47,R47:BT47,">0",$R$3:$BT$3,G47)

=AGGREGATE(15,6,1/(R47:BT47/($R$3:$BT$3=G47)),1)
 
Upvote 0
Maybe something like this:
Change ranges to match your data.

The problem is that you can't change the format because the item that is in a row has multiple prices, if you put the prices in a column instead of the row then you will only be able to have one price per item but that's not the case.
 
Upvote 0

Forum statistics

Threads
1,215,390
Messages
6,124,670
Members
449,178
Latest member
Emilou

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