I'm looking to figure out the break even variables for a variety of columns based on the following spreadsheet.
Locations have a set number of devices (column B) and transactions (column C) that occur.
I would like to figure out a formula for columns M-Q that would show the break evens for each of those columns.
I made the following adjustments to match these specific columns for "Location 1" as an example:
Calculated value M3 by updating the cell, C3, until E3 (variable) matched J3 (static).
Calculated value N3 by updating the cell, C3, until F3 (variable) matched K3 (static).
Calculated value O3 by updating the cell, B3, until J3 (variable) matched E3 (static).
Calculated value P3 by updating the cell, B22, until J3 (variable) matched E3 (static).
Was not able to figure out a simple way to figure out how many years it would take to match lane model (static) to the per stransaction model (variable).
I'd like the sheet to be dynamic meaning if I adjust any of the variable fields B3:B18, C3:C18, or B22:B24 that I would get the breakeven values in columns M-Q to update automatically.
I think that I've got part of the answer for you - still working on the rest.
Try these two formula, in M3 and N3.
Break Even Transactions in M3
=ArrayFormula((H3:H+I3:I)/$B$23)
Break Even Transactions 5 Yr in N3
=ArrayFormula(((H3:H+(5*I3:I))/5)/$B$23)
UPDATE
Joe, I think I have the remaining three formulas that you need. Please check the results to see that they make sense, but I believe that I have the correct logic in the formulas.
Note also that to help me follow the logic, I used named ranges for three variables, which you currently have in cells B22, B23, and B24. I find it increases the chance of errors if I mix up true data with different types of variables or constants, so I moved them off to the right in my sample sheet. Your B22 I named PerLicenseCost, B23 is PerTransCost, and B24 is MaintRate.
The new formulas are as follows:
Break Even Device Count
=ArrayFormula(ROUNDUP(((C3:C*PerTransCost)/(1+MaintRate))/PerLicenseCost))
Break Even Avg. License Fee
=ArrayFormula(((C3:C*PerTransCost)/(1 + MaintRate))/B3:B)
Break Even Years
= ArrayFormula(-1 * (B3:B * PerLicenseCost) / ((B3:B * PerLicenseCost * MaintRate) - (C3:C * PerTransCost)))
Note that for the Break Even Device Count, I used ROUNDUP on the result in the formula, so that it would not include a fraction of a device. You may not want this.
For the Break Even Years, there were four negative results. I'm hoping this means that those locations are losing money, and will never break even, but I'll let you review them and decide that.
Note also that you can easily modify these formulas to move them up into the header row (row 2), if you prefer. To do that, in the header of the desired column, copy the existing formula from the cell below WITHOUT the equal sign and paste in to the following:
={“ text header for the column “; PASTE CURRENT FORMULA HERE }
Be sure to then delete the formula in the cell below (in row 3) or you’ll have a #REF error. If you need any help with this, let me know.
Let me know if you have any questions about any of this. I’ll be happy to answer them, but possibly not for a day or two.
Related
There are 2 sheets: Data and Stats. Data contains records (several hundred) that are divided into ~20 categories. On the Stats sheet, I want to do various calculations. Is there a way to compose formulas in a way to take in only the categories that are enabled?
Previously, this was implemented in Excel, where SUMIFS function makes it possible (the conditions are inclusive). But in GS SUMIFS does not evaluate further conditions if condition1 is true. Or: I'm doing something wrong. Totally possible.
=SUMIF(Data!K:K, "<="&G3, Data!N:N) This version is a single condition. It says 'give me the sum of N column on Data sheet, provided corresponding value of K is less than or equal to G3'.
SUMIFS(Data!N:N, Data!K:K, "<="&G3, Data!B:B, G2:G20) (the syntax is slightly different in comparison with SUMIF)
Here, range G2:G20 contains the list of categories that I want to be able to switch on and off, and B column contains category labels. In Excel, when you indicate a range like this, it works. In GS - not so much.
Regardless of the Excel implementation, what would be the best way to achieve this on/off functionality in Google Sheets?
try:
=SUMPRODUCT(FILTER(Data!N:N, Data!K:K<=G3,
REGEXMATCH(""&Data!:B:B, TEXTJOIN("|", 1, G2:G20))))
note that G3 is overlapping with G2:G20 so something is not right in your referencing tho
This is hard to explain so my title sucks, and is just my best guess at how I might be able to approach this. I have a Google Sheet of sales data for cases of various bottle sizes of kombucha. Column E is the sale date, Column G contains the item code, and column J is the quantity sold of said cases. See my (vastly simplified) sample data:
https://docs.google.com/spreadsheets/d/17-LzGrNJtBr-FwOZtdaoCws3ayeGOHu_TdtGOfXj4cA/edit?usp=sharing
See my current test code below (also present in the Formula tab of the linked spreadsheet). It successfully gives me the combined number of cases sold of half-liter bottles and Growlers. The values in E4 and E5 are cells containing my start and end dates, respectively, so I'm constraining the results only to those which fall within a certain date range.
This code works, but now I need to figure out a way to sum the total number of bottles sold instead of # of cases. The data set is already massive and pushing the limits of google sheets, so adding a column to the source data sheet with # of bottles per case is not an option. Half liter cases hold 13 bottles, and growlers hold 5. Is there any way to do this with my current approach, using another array perhaps? Or any other approach that keeps the formula as simple as possible?
FYI the current formula is a proof of concept and I will be adding many additional types of cases to the existing formula, each containing a different number of bottles per case, and using it as part of a larger dynamic formula that allows you to switch between showing # cases vs # bottles vs # of actual liters sold, so this is why I am hoping to find an array-based approach that will let me do this without needing to resort to an absurdly long and complex formula of nested IF statements.
=SUMPRODUCT(--((XeroInvoiceData!$E$3:$E>=B4)*(XeroInvoiceData!$E$3:$E<=B5)), (--(ISNUMBER(MATCH(XeroInvoiceData!$G$3:$G, {"HalfLiterCase","GrowlerCase"}, 0)))), XeroInvoiceData!$J$3:$J)
I would be eternally grateful for any assistance.
Here is my solution:
https://docs.google.com/spreadsheets/d/1ig0krumJu4Lj9-nIKJyRfPLTYbU-mzOL0JokRUDEqNc/edit?usp=sharing
My idea was to filter your table on date and sum by the type of container.
I wanted also to allow new types of containers that contain smaller units (bottles or liters).
I divided this job into 3 stages.
First we have to filter this table according to selected dates and container types.
I prepared a list that may be extended (all you need is to extend the filter range).
Then I have to vlookup values of units in each container and I try to do it inside the same formula.
General idea is
={[query results],arrayformula(ifna(vlookup([first column of query],$C$21:$D$26,2,0)*[second column of query])}
I divide it into 2 stages.
First stage referrs to query results in adjacent table:
Second stage uses indexes of query so formula is quite long:
Tell me if it solves your problem.
I think this is the hardest to date I have had to crack - so hard I had a hard time finding a good headline.
So we have a site where trucks come and buy say Gravel, or sand or other building materials.
Sometimes they also unload demolition waste first.
I need to find out a couple of things
how many trucks (and from what companys) came empty
if they came empty what did they buy from us.
what companys are sending full trucks and what are sending empty trucks.
a tope 10 of materials they will drive to us from to buy even when coming empty to our facility.
a list of all the order numbers that they drove to us til fill and came with empty trucks. ( I have distances linked to order numbers, so now I can estimate the value of our products)
The data I have available:
I have a full data set of when what customer buys what and / or pay to deliver.
E.G.:
I can see the parts I need to split the data into I think it should be something like this
find all unique licence plates
somehow map if they bought materials within 30 minutes of
offloading demolition waste (most trucks will come between 2 and 10
times per day)
Present all this data (on a normal day we have about 800 trucks = 2000 lines since they weigh in, weigh out, and then some buy something = 2 more weigh lines)
I can easily find unique licence plates per day (either by formula or by Excel function Data/delete doublets,
but after that I have no clue where to start.
I think I need some sheets in between, where I somehow mark if a material was bought from an "empty truck" and I need a counter for that .. somehow...
Any help on how to get started is appreciated.
It seems like the best way to start is with a helper column (in the following exampes, I have chosen "Column M") to flag whether the truck arrived empty.
In the helper column, you can use something similar to the following formula.
{=IF(ISBLANK(B2),0,IF(C2="In",0,IF(B2=$B$2:$B$13,IF($C$2:$C$13="In",IF($A$2:$A$13>(A2-TIME(0,30,0)),0,1),1),1)))}
This is an array formula, which means you have to press ctrl+shift+enter after pasting it in the cell. Then you can copy that cell down the column.
Just to explain, the first if statement knows the truck is not arriving empty if Column C is 'In'. The second if statement creates an array and tests to see if other the same truck appears in other rows. The third if statement checks to see if the same truck checked 'In' in the matching rows, and the fourth if statement verifies if the time they checked in was less than thirty minutes ago. You can adjust the length by editing the TIME(0,30,0) function. The format is TIME(hours,minuites,seconds). Unless the truck matches all three of the second, third and fourth if statements, it is marked as coming empty.
Once you have this helper column, just about all of your tasks are quite simple.
1a: How many trucks came empty? Sum Column M
1b: How many trucks from what company? Create a unique list of companies. Then create a COUNTIFS formula based on Column M = 1 and Column K = Company. For example, if C32 had Company B then the formula =COUNTIFS($M$2:$M$13,1,$K$2:$K$13,C32) would return 2
1c: How many times did a truck come empty? Similar to 1b, create a unique list of License Plates, then use a COUNTIFS based on Column M = 1 and Column B = License Plate.
2: Similar to 1b, just use a unique list of products tested against Column F
3: Similar to 1b, just create a second column, next to the first that uses =COUNTIFS($M$2:$M$13,0,$K$2:$K$13,C53,$C$2:$C$13,"In") Which tests that Column M reports the truck did not come empty, that matches the company in Column K and that the truck came 'In' so you don't double count the same truck when it goes 'out'
4: Just sort list created by number 2. You can highlight the range, right-click and select "Sort" > "Custom Sort", then select the column you want to sort on and largest to smallest.
5: There are a couple of different ways, you could do this. The formula
{=TEXTJOIN(", ",TRUE,IF($M$2:$M$13=1,$J$2:$J$13,""))}
(again, entered as an array formula)
would create a comma separated list of order numbers. An alternative if you want a column of order numbers (but would only work if they are actually numbers), is to paste the formula {=MAX(IF($M$2:$M$13=1,$J$2:$J$13,))} in the first row of the column (in my example, its O2) and then {=MAX(IF($M$2:$M$13=1,IF($J$2:$J$13<O2,$J$2:$J$13,)))} in the row below (change the reference to O2 if you pasted it in a different spot)(again, note that both of these are array formulas). Then copy and paste the second formula down the column. When order numbers of trucks that came in empty are exhausted, the formula will report 0.
I am having some troubles formulating my problem but I hope you understand!
I have a table of firms building production plants in foreign countries in certain years. (Columns A to C).
In a seperate table i have so-called cross-national distance measures (based on the difference in gdp of the countries). (Columns G to M). Note that the distances change per year.
A simplified version of the excel would look like this:
https://new.wu.ac.at/fileadmin/wu/d/i/iib/photo/stack.JPG
What I want is a formula for the manually entered results in column D. It shall give me a result which is the following:
It shall look in which countries the specific company has previously (years before) built plants
It shall find the smallest cross-national distance from the current country to any of the countries previously entered
The value should be for the year of the current plant-construction
Let me illustrate my request with the example result i would want in cell D8:
The formula would have to find a list of countries that were previously entered in this case Turkey and Bulgaria
It would then have to into the second table and give me the minimum of the distances from Kosovo but only to Turkey and Bulgaria
This would have to be done in the rows for 2008 (current year)
I really hope you guys can help me, i figured out a way to find a minimum in a list and i can do it for certain years as well but the issue i am having that excel first needs to find the previously entered countries, memorize them in some kind of array and then use only these countries to consider the minimum distance.
Thank you very much!
Try this "array formula" for D2 copied down
=IFERROR(SMALL(IF(COUNTIFS(A$2:A$11,A2,B$2:B$11,"<"&B2,C$2:C$11,"<>"&C2,C$2:C$11,I$1:M$1)*(G$2:G$31=B2)*(H$2:H$31=C2),I$2:M$31),1),"N/A")
confirmed with CTRL+SHIFT+ENTER
That checks three conditions for your larger table - that the header row matches a qualifying country (using COUNTIFS function based on criteria in the small table), that column G matches the current year and column H matches the current country.
If all those criteria are satisfied then the relevant values in the table are returned, and SMALL finds the smallest. If there's an error (because there are no qualifying values) then N/A is returned
In Excel 2010 or later versions you can use AGGREGATE function instead of SMALL - this is useful because it doesn't require "array entry"
=IFERROR(AGGREGATE(15,6,I$2:M$31/(COUNTIFS(A$2:A$11,A2,B$2:B$11,"<"&B2,C$2:C$11,"<>"&C2,C$2:C$11,I$1:M$1)>0)/(G$2:G$31=B2)/(H$2:H$31=C2),1),"N/A")
I have an issue with computing the number of unique patients and/or MRN. I crossed referenced one patient to their respective ID three times to make sure every patient only has exactly one unique MRN, even those they may appear more than once in the Excel database. My problem is using the formula:
=SUM(IF(FREQUENCY(MATCH(E4:E317,E4:E317,0),MATCH(E4:E317,E4:E317,0))>0,1))
for the names of patients, results in 94, which I'm confident is correct, but:
=SUM(IF(FREQUENCY(MATCH(F4:F317,F4:F317,0),MATCH(F4:F317,F4:F317,0))>0,1))
for the MRN of patients results in 95, which does not match. This initially prompted me that maybe a patient accidentally has two MRN. However, when I crossed-referenced multiple times to make sure one entry at a time, this is not so.
Any ideas why this occurred?
A PivotTable can be a quick and quite easy way to identify where 2-tuples whose components should be unique pairs are not, in a few cases (other solutions may work better where many are not):
The number of 2-tuples that can be checked in a single 'pass' is almost unlimited and mismatches can be identified by blank rows. In the example MRN 4.00 is associated with two names, a and d and it can be seen a is also associated with MRN 1.00 .
Alternatively, Remove Duplicates and sorting would achieve much the same result, though evidenced by one or more repeat values, rather than by blanks.
Try inserting a column next to name. Assuming new column next to name is F place the following in F4:
COUNTIF($E$4:$E$317,E4)
then cut and paste F4 into F5:F317
Sum Column F
Use the same approach for MRM.