I've been struggling with this problem all morning.
I have a basic list:
Rows are customers
Columns are all dates with orders
Values are how many orders were placed on said date
I'm trying to get the average days between orders for each of the customers, but I cannot think of the right way to do this, since each customer ordered on different days.
I can't even think of how to get it to something that looks like this, where each customer row only has the order dates, consecutively. With this I could easily calculate days and average with helper columns.
Try this. Note that the formula is an array formula.
The formula computes the number of days between each date on which there is an order, and then averages those values. If this is not what you want, you will need to be specific.
To enter/confirm an array formula, hold down ctrl + shift while hitting enter. If you do this correctly, Excel will place braces {...} around the formula seen in the formula bar.
Related
When an employee works overtime for a client, we allocate those hours to the client's most recent shift (farthest row down for that employee), and then allocate the remaining OT up the rows. Column D lists total hours to allocate. Column E is a formula for OT hours available; I am trying to convert Col E to an array, but am running into a circular dependency error:
Formula that works
=IF(D2>0,D2,E3-C3)
Array formula that results in a circular dependency error:
=ARRAYFORMULA(IF(D2:D>0,D2:D,E3:E-C3:C))
I do not want to enable iterative calculations, as my sheet is about two thousand rows. I have read cumulative sum posts that incorporate MMULT and ROW, or SUMIF and ROW into the ARRAYFORMULA function, but I cannot figure out how to cumulatively decrease a number as it moves up rows.
Here is a link to the sheet
Thank you.
I made a new tab called MK.Help and put this formula in E2. If i understand what you're going for, i think it'll work?
=ARRAYFORMULA(MMULT(N(A2:A=TRANSPOSE(A2:A))*(ROW(B2:B)<=TRANSPOSE(ROW(B2:B))),D2:D-C2:C)+C2:C)
=IFERROR(AVERAGEIFS('Journal Input'!$AO$4:$AO$480,'Journal Input'!$O$4:$O$480,">="&F10,'Journal Input'!$O$4:$O$480,"<="&EOMONTH(F10,0)),"N/A")
This formula works but I need multiple average ranges added to this equation. My first average data range is AO but I have others in different columns (BB, BM, etc.) I would like to average along w/ AO. My multiple criteria's cover the beginning and end of the month F10. Perhaps an array is necessary? Any help is appreciated. Thanks Mike Link to picture example here
Here's a couple options. Enter this as an array formula (Ctrl+Shift+Enter):
=IFERROR(AVERAGE(IF(('Journal Input'!$O$4:$O$480>=F10)*('Journal Input'!$O$4:$O$480<=EOMONTH(F10,0)),CHOOSE({1,2,3},'Journal Input'!$AO$4:$AO$480,'Journal Input'!$BB$4:$BB$480,'Journal Input'!$BM$4:$BM$480))),"N/A")
Or, since it's the same conditions for all columns, you can average the AVERAGEIFS of each column (this doesn't need to be entered as an array formula):
=IFERROR(AVERAGE(AVERAGEIFS('Journal Input'!$AO$4:$AO$480,'Journal Input'!$O$4:$O$480,">="&F10,'Journal Input'!$O$4:$O$480,"<="&EOMONTH(F10,0)),AVERAGEIFS('Journal Input'!$BB$4:$BB$480,'Journal Input'!$O$4:$O$480,">="&F10,'Journal Input'!$O$4:$O$480,"<="&EOMONTH(F10,0)),AVERAGEIFS('Journal Input'!$BM$4:$BM$480,'Journal Input'!$O$4:$O$480,">="&F10,'Journal Input'!$O$4:$O$480,"<="&EOMONTH(F10,0))),"N/A")
I have a Google spreadsheet with two sheets, that I want to use to plan the calendar for my staff. One sheet is called "maquinas" (machines). The rows are the dates and the columns are the machines. Inside each cell there's the name of the operator of the machine. Like this:
Note that:
-some machines are inoperative some days (marked in black)
-there are special days when a machine that normally is operative has to close (cell H5)
-some operators have to operate several machines the same day
I have another sheet called "personas" (employees), where I want that each employee only has to look to one cell to know everything he has to do on each day (a list of all the machines that he must operate that day). This is an example of the desired result:
The order in which the machines appear in each cell is not important, as long as every one of them appears.
I have no idea about how to solve it. I have tried to bypass it creating a huge "tridimensional spreadsheet", with dates in the rows, employees in the columns, and machines in the sheets (in the third dimension), and concatenate towards the first sheet. It works, but then is very cumbersome and error-prone to make changes in the employees' daily work.
I have a bad feeling. Probably it will need code or array formulas, and the function concatenate doesn't work with arrays. And I have no idea of how to code in VBA, much less in Google Spreadsheets.
I think I have something you can try. Manually set up on your "personas" sheet,
enter the employee names in row 1 and the days in column A. Just as they are on
your example. Then paste this formula in cell B2:
=iferror(join(" ",(query(transpose(QUERY(maquinas!$B$1:$M$5 , "select * " )),"select Col1 where Col"&index(row())&" contains'"&B$1&"'"))))
Then drag the formula in B2 down as far as you need for days (If days are
not yet entered, they will show as blank.) Then highlight all the all the
cells with formulas in column B and drag it right to column J.
The "maquinas" is fine as is.
Let me know if you have a problem or need anything explained.
Here is a link to my working test spreadsheet. Make a copy and try it.
If you are using a different language, you may need to change the , to ;
in the formulas.
https://docs.google.com/spreadsheets/d/1jqDkYTy3rssqeKGJyLYzcMJ27c5X3a1P5osKkWPNOoM/edit?usp=sharing
I have a cell that currently uses an array formula to return the name associated with the minimum hours worked for all my employees. However, what I am trying to do now is write an array formula that lists the three next employees with lowest hours. I have written a formula similar to this in the past, but can't seem to get the two formulas to appropriately match up.
My current return minimum employee formula in G5:
={INDEX(A:A,MATCH(MIN(IF(B:B=G3,IF(C:C>=$G$2,D:D)))&G3,D:D&B:B,0))}
Here is an example of my data:
...and now I'm attempting to incorporate in into the following array formula that would return a list of qualifying results as I dragged it down a column:
={(IF(ROWS(G$7:G7)<=F$8,INDEX($A$2:$A$8,SMALL(IF(Employees!$B$2:$B$8=$G$3,ROW($A$2:$A$8)-ROW($A$2)+1),ROWS(G$7:G7))),""))}
Currently, this array formula is only set up to match on position title and not the other qualifiers that I need from my minimum employee formula. How can I mesh the two formulas correctly? Thank you for any and all help and please, let me know if you need any clarification.
The ideal array result would show Boris and two blanks in consecutive rows in the Next 3 Employees chart.
Set your page up like this:
With the ranking in column F.
Then it is a quick modification of the last formula. Instead of MIN we use Small. The k part of the small equation is the ranking number:
=INDEX(A:A,MATCH(SMALL(IF(B:B=$G$3,IF(C:C>=$G$2,D:D)),F5)&$G$3,D:D&B:B,0))
This goes in G5. Is confirmed with ctrl-shift-enter. Then copied down for rows.
If do not want the errors to show then wrap it in IFERROR:
=IFERROR(INDEX(A:A,MATCH(SMALL(IF(B:B=$G$3,IF(C:C>=$G$2,D:D)),F5)&$G$3,D:D&B:B,0)),"NO MATCHES")
I am trying to find an easy way to calculate commissions off of sales on multiple sheets within a workbook. Each month, I need to find the total net profit for only items sold within the specified month.
The formula I am currently using is:
=SUMPRODUCT((TEXT('Sheet Name'!$P$3:P24,"MY")=TEXT($G$4,"MY"))*'Sheet Name'!$M$3:M24)
Column P shows the Sold Date,
Column M includes a formula in each row to calculate the net profit, and
cell G4 is where I would enter the month & year I am currently working with.
I have come to the conclusion that it only gives me the #VALUE! error because of the formula in each row of Column M (example: =IF(OR(F15=0,G15=0)," ",(F15-L15)) ).
When I reference a different column (in place of Column M) that does not contain formulas it works perfectly (example: =SUMPRODUCT((TEXT('Sheet Name'!$P$3:P24,"MY")=TEXT($G$4,"MY"))*'Sheet Name'!$G$3:G24) ). Also, changing the astrisk to a comma causes the formula to calculate incorrectly and add the (--(TEXT double negative does not fix the problem.
How to I get this array to calculate without removing the formulas from Column M?
Thanks for your attention.
I presume it is giving you a #VALUE error because your formula results in text (a space) and it errors when trying to multiply a space by a number (aka True or False). I think you would be better served changing your M column formula to =IF(OR(F15=0,G15=0),0,(F15-L15)). Do you have a specific reason to not make it evaluate to 0? Also is there a reason you are converting to text to do your month/year check?
Try something like this: =SUMPRODUCT(--(MONTH('Sheet Name'!$P$3:P24)=MONTH($G$4)),--(YEAR('Sheet Name'!$P$3:P24)=YEAR($G$4)),'Sheet Name'!$M$3:M24). Of course this is dependent on entering the dates as actual dates. The -- is used to change a logical/boolean (true/false) into a 1 or 0. It won't do anything useful to text. For example, it should also work as =SUMPRODUCT((MONTH('Sheet Name'!$P$3:P24)=MONTH($G$4))*(YEAR('Sheet Name'!$P$3:P24)=YEAR($G$4))*'Sheet Name'!$M$3:M24) since the multiplication converts the truthy statements to numbers. The trick is to make sure when everything else evaluates, you have =sumproduct(numbers,numbers,numbers). Your instance is one array of =sumproduct(numbers/text).