First and foremost. I'm totally new to "programming" in Excel.
I'm trying to make a price calculator, that calculates the price when I use my printer.
The sheet contains list, so I don't need to type in numbers but can choose between some options.
I would like options within the list to have a value.
My sheet contains theese information.
Description, Amount, Single/duplex, Format, Printing price, Paper price, Total price.
Description: Could be "Printing an invitation for my brother"
Amount: Amount printet
Single/Duplex: A list containing "Single" and "Duplex"
Format: A list containing "A4", "SRA3" and "SRA3 HiGloss"
Printing price: The total price
This is how it's calculated:
'Format' + ('Amount' x 'Single/duplex') = 'Printing price'
I would like to assign theese values to the list options:
Single/Duplex
Per page (singlex): 0,6
Per page (duplex): 1,2
Format:
A4. paper: 0,2
SRA3 High Gloss: 1,25
SRA3: 1
Example
Description Amount Single/Duplex Format Printing price
Invitations 30 Duplex SRA3 HiGloss 61,25
The calculation for this example looks like this:'Format' + ('Amount' x 'Single/duplex') = 'Printing price'1,25+(30*2)
Does anyone know about this???
I would make a price lookup sheet and have the prices laid out in table form i.e.
A B
Single 0.6
Duplex 1.3
A4 0.2
And so on…
You can then use the vlookup function to turn the options given into their value counterpart
=VLOOKUP(B3,Price_lookup!A1:B20,2,FALSE)
You can then use this as the basis for building your formula
EDIT:
Ok here is a very rough example in excel but it works. You can unhide the columns to show how it works
http://www.easy-share.com/1910066813/Stack_example.xls
Related
Hi Stackoverflow Community,
This is my first post, apologies ahead if I haven't structured my question better, I'll try to improve on it later on.
I have a 2 excel columns with street address numbers and street address, none of which are unique hence using vlookup/index match is tricky.
I am trying to populate another column with the minimum and maximum value of the street address numbers using TEXTJOIN and it works, however I need the min/max for each specific street address group, there are close to 1 million lines of data.
For example, min=1, max=13, on florence st, min=3, max=53, on gibson st
Is such a formula helpful for you:
=MINIFS(B$2:B$10,A$2:A$10,"Ramsay street")
As you see, I take the minimum value of the "B" column, based on a criterion on the "A" column.
Hereby a screenshot of an example:
If you are on Excel 365 - current channel you can use this formula:
=LET(streetnamesUnique,UNIQUE(data[StreetName]),
minNumber,BYROW(streetnamesUnique,LAMBDA(s, MINIFS(data[Number],data[StreetName],s))),
maxNumber,BYROW(streetnamesUnique,LAMBDA(s, MAXIFS(data[Number],data[StreetName],s))),
HSTACK(streetnamesUnique,minNumber,maxNumber))
If on Excel 365 semi annual channel:
=LET(streetnamesUnique,UNIQUE(data[StreetName]),
minNumber,BYROW(streetnamesUnique,LAMBDA(s, MINIFS(data[Number],data[StreetName],s))),
maxNumber,BYROW(streetnamesUnique,LAMBDA(s, MAXIFS(data[Number],data[StreetName],s))),
MAKEARRAY(ROWS(streetnamesUnique),3,LAMBDA(r,c,
IF(c=1,INDEX(streetnamesUnique,r),
IF(c=2,INDEX(minNumber,r),
INDEX(maxNumber,r))))))
Both formulas first retrieve the unique streetnames - then retrieves, per each streetname min and max number.
In the end the new range is built from these values - either by HSTACK or MAKEARRAY.
I am trying to separate information copied from a PDF table - id usually use text to columns but the only delamination is spaces and this then splits the data into multiple unusable columns
The data comes like this:
Raw Data
A1 Company 0
Company2 40000
name a 1
name b 15
name c 184
Big 17 Company 1887
I need the output to be:
Company
Units
A1 Company
0
Company2
40000
name a
1
name b
15
name c
184
Big 17 Company
1887
So the company name (that might contain numbers) is separated for the unit number (that could be 1-5 digits long).
I haven't been able to figure out a way that uses =len() as the string length isn't a constant mixed with the last numbers not being a consistent number of digits.
I'm currently using:
=SUMPRODUCT(MID(0&A2, LARGE(INDEX(ISNUMBER(--MID(A2, ROW(INDIRECT("1:"&LEN(A2))), 1)) * ROW(INDIRECT("1:"&LEN(A2))), 0), ROW(INDIRECT("1:"&LEN(A2))))+1, 1) * 10^ROW(INDIRECT("1:"&LEN(A2)))/10)
This gives me all the numbers in the cell - which works for 90% of the data as most of the company's don't have numbers in their name. But for something like 'A1 Company 0' it gives 10 as the output not just the 0. I then go and manually edit the small number of companies that this happens too.
I then use a mixture of =LEN() =LEFT and =RIGHT to split the information up as required for the further automated analysis.
I'd prefer a formula over VBA/macro
I cant provide the actual data but I hope I've given enough examples in the table above to show the main problems (different company name lengths, companies with numbers in their name, different amount of digits representing the units)
Using Libre Office, but this formula checks for the last space in the cell
=RIGHT(A1,LEN(A1)-FIND("#",SUBSTITUTE(A1," ","#",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))),1))
Taken from: https://trumpexcel.com/find-characters-last-position/
FILTERXML() would best choice for this case. Try-
=FILTERXML("<t><s>"&SUBSTITUTE(A1:A6," ","</s><s>")&"</s></t>","//s[last()]")
Details about FILTERXML() from JvdV here.
See if the following works for you:
Formula in B2:
=LEFT(A2,LEN(A2)-1-LEN(C2))
In C2:
=-LOOKUP(1,-RIGHT(A2,ROW($1:$5)))
For those users using ms365's newest functions:
=HSTACK(TEXTBEFORE(A2," ",-1),TEXTAFTER(A2," ",-1))
I have been working on a price list for one of our salespersons.
Every time there is an "X" in the file, it indicates that the index prices of our raw materials have increased/decreased more than +/- 50 EUR/ton compared to our current prices.
As you can see on the column '01-04-2023' (above the marked field), there is an "X", which in this case indicates that the index price has changed more than +/- 50 EUR/ton (1,983 - 1,910 = 73 EUR/ton) compared to the current price, so it meets the criterion for displaying the "X"-symbol. Because the index price is now 1,910 EUR/ton (which you can see in the yellow and marked field), this should be the 'new price' in the '01-07-2023'-column to the right (see picture).
... So my question is. How do I get the '01-07-2023'-column to read from right to left and find the first case, where there is an "X" in the 'Price adjustment?'-row. The correct formula should return 1,910 EUR in the 'new price'-row / '01-07-2023'-column.
So far, I have used the following formula: HLOOKUP("X";$G$12:L14;3;TRUE), and it is actually working in all the columns before the '01-07-2023'-column.
Is there anyone who can help me find a proper solution?
Thanks in advance.
I'm making an excel sheet for calculating z-score for infant weight/age (Input: "Baby Month Age", and "Baby weight"). To do that, I need get LMS parameters first for a specific month, from below table.
http://www.who.int/childgrowth/standards/tab_wfa_boys_p_0_5.txt
(For Integer Month number, this can be done by vlookup Method without issue.) For Non-Integer Month number, I need use some kind of "linear interpolation" approach to get an approximate LMS data.
The question is, both Trend method and Vlookup method are not working for me. For Trend method, it is not working as the raw data, like L parameters is not linear data, if I use Trend method, for the several top month, return data will far from existing data. As for Vlookup method, it just finds the closest month data.
I had to use multiple "Match" and "Index" Method to do the "linear interpolation" for myself. However, I wonder whether there is any existing function for that?
My current formula for L parameters is below:
=MOD([Month Age],1)*(INDEX('WHO BOY AGE WEIGHT'!A:D,MATCH([Month Age],'WHO BOY AGE WEIGHT'!A:A)+1,2)-INDEX('WHO BOY AGE WEIGHT'!A:D,MATCH([Month Age],'WHO BOY AGE WEIGHT'!A:A),2))+INDEX('WHO BOY AGE WEIGHT'!A:D,MATCH([Month Age],'WHO BOY AGE WEIGHT'!A:A),2)
If we assume that months increment always by 1 (no gap in month data), you can use something like this formula to interpolate between the two values surrounding the give non-integer value:
=(1-MOD(2.3, 1))*VLOOKUP(2.3,A:S,2)+MOD(2.3, 1)*VLOOKUP(2.3+1,A:S, 2)
Which interpolates L(2.3) from data of L(2) = .197 and L(3) = .1738, resulting in .19004.
You can replace 2.3 by any cell reference. You can also change the lookup column 2 for L into 3 for M, 4 for S etc.
To answer the question whether there is some direct "interpolate" function in Excel, not that I know about, although there is good artillery for statistical estimation.
I have a 'points matrix' the idea is, a sales person sells an item to a business, dependant on what product and the date it was booked (creation date) an amount of points is allocated.
'Product 1 +', 'Product 2 +', 'Product 3+' are the same products as product 1, 2 and 3. However they become + when they meet the criteria of being new (Column 'New' = YES).
What is the best way to pull through the correct points when following the above criteria? Happy to use VBA or formulas but would prefer both.
By assuming you first row in points in number 14
Try this formula in cell "F14": =IF(E14="YES",VLOOKUP(D14,$A$2:$G$11,MATCH(CONCATENATE(C14," +"),$B$1:$G$1,0)+1,FALSE),VLOOKUP(D14,$A$2:$G$11,MATCH(C14,$B$1:$G$1,0),FALSE))
You could also do this, I prefer using INDEX MATCH, since it is more flexible. The concept is the same.
=IF(E14="YES",INDEX($A$1:$G$11,MATCH($D14,$A$1:$A$11,0),MATCH($C14&" +",$A$1:$G$1,0)),INDEX($A$1:$G$11,MATCH($D14,$A$1:$A$11,0),MATCH($C14,$A$1:$G$1,0)))