Solved

Find out which units in a list equal a certain amount

Posted on 2012-03-16
2
183 Views
Last Modified: 2012-03-16
Hello experts,

I want to buy some assets listed below in Table A

Table A
 12,40  
 12,60  
 14,10  
 14,70  

I can buy those assets with the values from Table B

Table B
 0,10  
 0,20  
 0,50  
 1,00  
 2,00  

I would like a formula or vba code that can calculate the way i can do it

e.g.

Table A      Solution
 12,40          6x2,00 - 2x0,20
 12,60          6x2,00 - 3x0,20
 14,10          7x2,00 - 1x0,1
 14,70          7x2,00 - 1x0,50 - 1x0,20


For the first asset i would need six of two and two of 0,2 and so on..


Thanks in advance
0
Comment
Question by:kpyrgos
2 Comments
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 500 total points
ID: 37728322
Enter Table A in A3:A6
Enter Table B in B2:F2 and in "Descending order"
Enter this formula in B3
=INT(($A3-SUMPRODUCT(--$A$2:A$2,--$A3:A3))/B$2)
copy this formula down and across
0
 

Author Comment

by:kpyrgos
ID: 37728346
Thank you sir!!

I never knew sumproduct could be used with "--".
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now