I have this formula that I use to calculate lead-time for jobs which works great for what I have needed. Now my job data is going to change in each row and the data I need will not always be in the same column as it once was. What I need to do is add to my existing formula to only fill in the leadtime IF any cells in the row contain the text "COMPLETED", otherwise leave the cell blank. Can anyone help with this?
=(IF(ISBLANK(P1),"",(IF(P1-G1<7,IF(WEEKDAY(P1)>WEEKDAY(P1),P1-G1-2,P1-G1),(P1-G1-(ROUNDDOWN((P1-G1)/7,0)*2))))))
Test the value of a Match formula in another If statement to see if it's greater than 1, here's an example using your existing formula. This is for row 1 where the word 'COMPLETED' could be in columns B to Z:
=IF(IFERROR(MATCH("COMPLETED",B1:Z1,0),0)>0,"Completed",IF(ISBLANK(P1),"",(IF(P1-G1<7,IF(WEEKDAY(P1)>WEEKDAY(P1),P1-G1-2,P1-G1),(P1-G1-(ROUNDDOWN((P1-G1)/7,0)*2))))))
Related
I am trying to format a group of cells but I need a custom formula for when the value of a cell is greater than the value of the cell in its column of a specific row it needs to be highlighted
(The highlighted value reference point in the group is in the same row)
Please help 😞
I tried to highlight by using the default option on each column but there are way too many rows
I don't have your exact spreadsheet. Let's say your range goes from A1:Z, and that the column of reference is column E (from each row). Then you can set this formula to:
=A1 > $E1
Change A1 to the first cell of your range and $E1 with the first corresponding column of the first row of the rage (if you start row 3, then put $E3 -- and change the letter ;) )
Let me know if this works for you!
I am just wondering whether it is possible to achieve what I need to achieve, but using an ARRAYFORMULA.
I have a simple setup where in column B I show the value, which is present in the last previous filled in row in column A
Here is an example.
So, the questios is: is it possible to achieve the same, but with ARRAYFORMULA(s), so that in case a new row is incerted, one does not need to drag formula to fill in the new row, but the formula would be added automatically. All my attempts ended up with the circular reference problem.
This is tradtionally done with a vlookup of row numbers into a filtered array of the values. It would look like this in row 4 of your sample sheet:
=ARRAYFORMULA(VLOOKUP(ROW(A4:A),FILTER({ROW(A4:A),A4:A},A4:A<>""),2,TRUE))
Example sheet: https://docs.google.com/spreadsheets/d/14ma-y3esh1S_EkzHpFBvLb0GzDZZiDsSVXFktH3Rr_E/edit?usp=sharing
In column B of ItemData sheet, I have achieved the result I want by copying the formula into every cell in the column, but I want to solve this using ArrayFormula instead.
In column C I have achieved the same result using ArrayFormula. However, for addition, column C is referring to cells in column B, while column B is referring to cells in column B. I.e. every cell in column B is adding 1 to the cell on the row above.
If I select the C3 formula text and paste it into the cell edit field for cell B3 (to not screw up cell references during copy - I know I could make them static references, but this is not my problem), the cell gets an error value of
#REF!
Error
Circular dependency detected. To resolve with iterative calculation, see File > Spreadsheet Settings.
Do note that the additions that need to be done are the same in both cases: Add 1 to the value of the cell on the previous row, so there is no circular reference involved. There is a starting value provided in B2, and cells in B3 and downwards should use the data from the B cell in the previous row.
Also, note that I did try File->Spreadsheet settings and enabling circular reference computation with max 25 items, but this only fills in the first two cells (B3 and B4).
How can I solve this problem? I would prefer having something like ArrayFormula, where the formula only exists in a single cell. But copy-pasting would be acceptable as long as any new rows, inserted in between or added at the bottom, would get the same formula added in column B.
Will matching items always be consecutive? It seems that way since you're comparing each Item cell to the cell above it right in your formula logic. That breaks an [unwritten?] rule of spreadsheet normalization; values' addresses themselves generally should not be treated as data.
IF you're committed to it though, have you considered explicitly using location as a data source? Example:
=ARRAYFORMULA(IFS(
NOT(LEN(A3:A40)),,
ROW(A3:A40)-3-MATCH(A3:A40,A$3:A$40,0)<=VLOOKUP(VLOOKUP(A3:A40,Items!$A$2:$D,2,false),DataPerColor!$A$2:$B,2,false),ROW(A3:A40)-3-MATCH(A3:A40,A$3:A$40,0),
true,
))
Just like your formulas, all that does in English is:
for each row,
if there's no Item, don't output any ItemData,
if the number that belongs in this cell¹ is less than or equal to the lookup, print it,
otherwise, don't output any ItemData
But then what is ¹ "the number that belongs in this cell" and how can we calculate it without using column B? I abuse locations of things to get it. Looking down your row B, each number that appears is just:
this row's number, minus
the row where items start [always 3], minus
the row number [in just the Item rows] of the first row containing this row's Item
Using the second-to-last ItemC as an example: the first ItemC is the 16th item listing, and the one we're looking up… the "second-to-last ItemC" is in row 21 of the sheet. 21-3-16 = 2 …the number you wanted.
If you can stomach that, it's a single formula and does work according to your specifications.
I want for every row in my sheet to calculate a score using a formula. So the same formula for each row. I tried this:
=ARRAYFORMULA(min((((C3:C100)/4)+((K3:K100)*4/10)+(M3:M100)+((N3:N100)/2.5)+((O3:O100)/5)+(R3:R100)+(T3:T100)+((P3:P100)/3)+(V3:V100))/23))
But it does calculate at all, for any row. (I am starting from row 3)
Why does it act like this? Any suggestions?
It's always best to provide us a link to your sheet, so we can see what you're trying to accomplish (or at least create a copy without sensitive data and share that).
If you want the same exact formula for each row, you will get the same exact result with your current formula. Also, do you mean to SUM the range values you have provided inside the formula? If so, you need to alter your formula to look like this:
=ARRAYFORMULA(min((((sum(C3:C100)/4)+(sum(K3:K100)*4/10)+sum(M3:M100)+(sum(N3:N100)/2.5)+(sum(O3:O100)/5)+sum(R3:R100)+sum(T3:T100)+(sum(P3:P100)/3)+SUM(V3:V100))/23)))
Please be more specific about exactly what you want the formula to calculate on each row. If it's on row 20, for example, do you still want rows 3-100 to be considered? Or just rows 20-100? WHAT data do you need to be considered on each row's formula, in other words?
Here's a sheet I created to try to understand what you want:
https://docs.google.com/spreadsheets/d/1GRdU6NLMWx2xPXDNp21VzYRQRj6cjNbL4RGVUV2x8Wk/edit?usp=sharing
I am currently using SUM on an entire column with the following formula:
=SUM(A2:A)
Unfortunately this total is displayed on the last row of this column, so it creates a circular reference, #REF, there that I need to get rid of. How can I make it so that it selects the column starting from the second row until the second-to-last?
I could change the formula manually every time I enter a new row, but that's not ideal at all.
Pseudocode
=SUM(A2:A[last row - 1])
See if this works
=sum(indirect("A2:A"&row()-1))