Google Spreadsheet LOOKUP with dynamical search result of VLOOKUP - spreadsheet

please have a look at my spreadsheet mini example screenshot for demonstration:
http://awesomescreenshot.com/0ab3l3xdeb
I have created a price matrix for price calculation. In the first row you will find the search range. This is the buying price (EK). B1 means that the buying price is > 0, B2 means the buying price is > 10, ....
In the next rows (one row for each brand) you will find the multiplicator in percent we will add to the buying price base on the seach range.
Example (works with row1 as search range and row2 as search result):
A7: This is the brand. That means we have to work with row 2. (this is static yet and my problem)
B7: This is the buying price. It is 50
D7: Base on the brand and the buying price I look in the matrix and got the value 20
C7: This will be the final price as we increase the buying price for 20%
This is my calculation:
=B7*((LOOKUP(B7, B1:F1, B2:F2)+100)/100)
I will need "B2:F2" for Brand 1, "B3:F3" for Brand 2, ....
How can I including the Cell A7 in my calculation, that it automatically use the search result of the right row? I thougt of something with VLOOKUP. But this seems not to work.
I have no more idea.
Please help

In Cell C7, you could use the following formula to allow you to do a horizontal and vertical lookup at once:
=$B$7*((INDEX($B$2:$F$3,MATCH($A$7,$A$2:$A$3,0),MATCH($B$7,$B$1:$F$1,0))+100)/100)
This will return what you are looking for, meaning that you can change the Brand and EK in cells A7 and B7 and your lookup will still work.

Related

Get price from table 1 if word is in the sentence tabel 2 (Excel, VBA, Vlookup, if, ? ,...)

I try to get a price (col "B" sheet "PP") if a product (col "A" sheet "PP") is in any of sentence (col "A" sheet "MASTER"). If not, then it should pick up the average price (cell "C2" sheet "PP"). I've tried to use several methods but only this one gives SOME ;) results:
=IF((LEN(B2)-LEN(SUBSTITUTE(UPPER(B2);UPPER(LEFT(PP!A2;LEN(PP!A2)-5));"")))/LEN(LEFT(PP!A2;LEN(PP!A2)-5))>0;VLOOKUP(PP!A2;PP!$A$2:$J$82;2;0);PP!C2)
As you can see on a picture only a few products get results and it's not correct. I think it's because counting characters is different for different words and phrases. Maybe there are some other errors in this formula.
In Picture 1 you can see products with prices and its average from the sheet "PP".
In Picture 2 you can see sentences in which are products in red color - sheet "MASTER". There is one sentence - cell "B8", where are two products, and formula can pick up any of them, can be i.e the first one. Three last products on the mint background aren't in the list (sheet "PP"). Therefore for them, the formula should take an average price from cell "C2" sheet "PP".
The formula should make a loop because the products from sheet "PP" can be in a few sentences.
Can anybody help me to solve this issue?
SOLVED:
=IFERROR(LOOKUP(2^15;SEARCH(PP!$A$2:$A$11;B2);PP!$B$2:$B$11);PP!$C$2)

Fetching data from row N+M, N+2M,... when N changes

My Google spreadsheet has webpage data imported with IMPORTDATA() on Sheet1. The data of interest are 20 pcs of 12-row deep posts starting at row N (e.g. row 123). Unfortunately, N changes each week or so.
Today I just use 20 hardcoded formulas that copy the data of interest to Sheet2 (e.g. =Sheet1!A123), but each time N changes I need to re-code all these 20 copying formulas on Sheet 2.
I'd prefer a method using e.g. Indexing or Offset formulas, where I would only need to change one "starting index" value when N changes in the webpage. Help would be much appreciated!
EDIT : Hi, thanks for your interest, sorry for delay. So this is the data structure of my Google spreadsheet. The source data can be considered a product list or similar.
Sheet1:
A1 =IMPORTDATA (url)
A2 to A122
A123 product 1 name
A124 product 1 price
A125 to A132... other product 1 data
A133 product 2 name
A134 product 2 price
A135 to A142... other product 2 data
A143 product 3 name....
... and so on up to product 20.
On Sheet2 I then want the following result:
A1 product 1 name
A2 product 1 price
A3 product 2 name
A4 product 2 price.
... and so on.
The problem is that the "uninteresting preamble data" in the beginning changes in length (number of rows) every now and then.

How to find the average of the cosecutive specified rows in a column

I want to find the average of every 100 rows consecutively in 2 million rows and save these 2000 values in a new column.
Can any one help me either by a VBA or by a Formula in Excel 2007.
waiting for the reply.
The trick here is to set-it up correctly. With the proper set-up, this is a cinch, really. VBA is just going to make this a wee bit easier, but native formulas can do just as well.
Assume I have values in A1:A1000. A1 has 1, A2 has 2, etc. You get the point. Eventually, A1000 has 1000.
Now, copy the following set-up for the specified cells:
B1: 1
C1: 100
B2: =C1+1
C2: =C1+100
Drag down to B10:C10.
Now, input the following formula to D1:
=AVERAGE(INDIRECT("A"&B1&":A"&C1))
Drag down to D10. Voila. You have the average of each 100-row cluster.
Screenshot:
Let us know if this helps.
A single formula:
=INT((ROW()-2)/100)
in say B2 and copied down (to group in hundreds) and a PivotTable with the ColumnB label as Row Labels and Average of the value label in Σ Values is quite straightforward.
If the banding is required, change the formula for =ROW()-1 and Group in the PT.

LibreOffice populating cells

I have a spreadsheet containing data identifying the depot where a product is stored, the supplier of the product and the manufacturer of said product.
I wish to break this one spreadsheet into four .csv files and import csv files into an already created PostgreSQL db. Typically, depot.csv, product.csv, supplier.csv and manufacturer.csv.
depot.csv has <15 entries, supplier.csv & manufacturer.csv <350 entries each and product.csv < 2,000 entries.
Example of what I want to do.
I have created a list of unique depots in a worksheet called depot.
id name
paris
berlin
london
original spreadsheet data
id Depot depot_id PRODUCT NAME product_id SUPPLIED BY Manufacturer
1 Paris 1 Hand wipes Erenco Chem Group
6 London 3 Scrub Towels Chemicraft Chem Group
7 Berlin 2 WR2 Grease Greasy Bin Chem Group
the column depot_id is populated by using the following formula
=IF(B2=depot.$B$2,depot.$A$2, IF(B2=depot.$B$3,depot.$A$3, IF(B2=depot.$B$4,depot.$A$4, 9999)))
and a worksheet called depot
Now I need a formula to populate product_id but above formula is not sufficient.
Thanks.
Tommy.
This problem is probably best solved by using the vlookup function.
Okay it's working.
Formula looks like this... in cell C2 enter the following
=VLOOKUP(D2,Product.$A$2:$B4586,2,0)
explanation:
D2 = the text being searched for
Product.$A$2:$B$4586 = the search array, in another worksheet, being searched
2, = the value to be posted in cell C2. This is from the column B in the search array. The leftmost column should be the column containing the value searched for.
0 = signifies a unsorted/unordered list.
See http://forum.openoffice.org/en/forum/viewtopic.php?t=46746 for better explanation.
Also http://wiki.openoffice.org/wiki/Documentation/How_Tos/Calc:_VLOOKUP_function
Thanks to Mauritz for reinforcing my research.
Tommy.

Sum of unfixed number of cells if corresponding cell has given value

I am strugling how to make this happen. I have a worksheet where the data is going to be read in. The size of the data will vary from time to time. I have programmed a generated summation column after the data is read in. I want each cell to sum all values in the row, with the index value in the first row equal to the value in the first row in the summation column. The picture might give you a less abstract visualization of the case. I included the manual formulas for row 3 in row 12 as text. I want to do this in VBA. There might be up to 50 sets ([2010,2011,avvik] or [2010,avvik] or [2011,avvik]). There are two variables with a saved number (column number) for both the start and the end of the data area.
In other words; The money column under "SUM 2010" (which in my program actually is only 2010) should sum every cell in the given row, which has the value 2010 in row 1 in the same column. The same goes for 2011.
(You might want to save/open the picture for details)
You can do this with the formula SUMIF. For Q3, you would write:
=SUMIF(A1:P1, "2010", A3:P:3)
In layman's terms, you are saying, look at all the cells in the range A1 - P1 and for each one, if the value happens to be "2010", I want you to add the value in the range A3 - P3 to the sum.
BTW, you can also use this formula in cell Q11 to get the totals instead of the current formula you have. The fact that the year dates and numbers are in the same column make this really easy.