I look for the following: I have columns with part names that make up a particular product, where I inform if the parts are defective or not. When the part is OK the default information is set to "#". All defects have a depreciation value from 0 to 10.
I want to concatenate in one cell all the defects that depreciate the product. In another cell, the defects that do not depreciate.
Here's the test sheet:
https://docs.google.com/spreadsheets/d/1HX2eko7v15mDja6_KlajmUaHkY4SCmKfELvPxqgnDUA/edit#gid=0
Actually I got a solution, however, there are 18 columns and the formula will be very large. Could someone come up with a smarter solution?
Here's my current script:
=IFERROR(CONCATENATE(LEFT(CONCATENATE(IF(A2<>"#";IF(VLOOKUP(A2;$H$2:$I$5;2;FALSE)<>0;A2&", ";"");"");IF(B2<>"#";IF(VLOOKUP(B2;$H$2:$I$5;2;FALSE)<>0;B2&", ";"");"");IF(C2<>"#";IF(VLOOKUP(C2;$H$2:$I$5;2;FALSE)<>0;C2&", ";"");"");IF(D2<>"#";IF(VLOOKUP(D2;$H$2:$I$5;2;FALSE)<>0;D2&", ";"");""));LEN(CONCATENATE(IF(A2<>"#";IF(VLOOKUP(A2;$H$2:$I$5;2;FALSE)<>0;A2&", ";"");"");IF(B2<>"#";IF(VLOOKUP(B2;$H$2:$I$5;2;FALSE)<>0;B2&", ";"");"");IF(C2<>"#";IF(VLOOKUP(C2;$H$2:$I$5;2;FALSE)<>0;C2&", ";"");"");IF(D2<>"#";IF(VLOOKUP(D2;$H$2:$I$5;2;FALSE)<>0;D2&", ";"");"")))-2);".");"OK")
and
=IFERROR(CONCATENATE(LEFT(CONCATENATE(IF(A2<>"#";IF(VLOOKUP(A2;$H$2:$I$5;2;FALSE)=0;A2&", ";"");"");IF(B2<>"#";IF(VLOOKUP(B2;$H$2:$I$5;2;FALSE)=0;B2&", ";"");"");IF(C2<>"#";IF(VLOOKUP(C2;$H$2:$I$5;2;FALSE)=0;C2&", ";"");"");IF(D2<>"#";IF(VLOOKUP(D2;$H$2:$I$5;2;FALSE)=0;D2&", ";"");""));LEN(CONCATENATE(IF(A2<>"#";IF(VLOOKUP(A2;$H$2:$I$5;2;FALSE)=0;A2&", ";"");"");IF(B2<>"#";IF(VLOOKUP(B2;$H$2:$I$5;2;FALSE)=0;B2&", ";"");"");IF(C2<>"#";IF(VLOOKUP(C2;$H$2:$I$5;2;FALSE)=0;C2&", ";"");"");IF(D2<>"#";IF(VLOOKUP(D2;$H$2:$I$5;2;FALSE)=0;D2&", ";"");"")))-2);".");"OK")
paste in D2:
=ARRAYFORMULA(REGEXREPLACE(TRIM(TRANSPOSE(QUERY(TRANSPOSE(
IF((A2:D<>"")*(A2:D<>"#"); A2:D&","; ));;999^99))); ",$"; "."))
paste in E2:
=ARRAYFORMULA(IF(B2:B<>""; IF(B2:B="#"; "OK" ; B2:B)&"."; ))
spreadsheet demo
Related
I have a Google Sheets document with a series of fields for every day in the year. The top row (Actually, row 2) is the Months (by full name, eg. January, February, etc.). The A column is numeric, from 1 to 31. There are several fields for each date, so the fields in the A column are merged (in other words, it's not A2, A3, A4 - more like, A2, A7, A12).
What I'd like to do is put a a hyperlink at, say, B1, that points to "today's" top field. So, today's would point to J7, and I could just click the link at B1, and get taken directly to that field.
I know this is going to involve the HYPERLINK function, but I can't figure out how to get it to work. Something like:
=HYPERLINK("#gid=0&#range=" & MATCH(TEXT(TODAY(),"MMMM"),2:2,0) & MATCH(DAY(TODAY()),A:A,1),"Click for today")
But I can't get it to work right. Any thoughts?
Assuming your months are in every column from B2:M2:
=HYPERLINK("#gid=*000000000*&range="&ADDRESS(MATCH(DAY(TODAY()),A2:A,1)+1,MONTH(TODAY())+1,4),"Click for today")
I wrote the formula so that the link could go in A1 without running into trouble, if you like. (It would also work in B1, etc.)
If there are spaces between your months, just reorder what you had so the MATCH for the row is first and wrap it in ADDRESS( row, column, 4):
=HYPERLINK("#gid=*000000000*&range="&ADDRESS(MATCH(DAY(TODAY()),A2:A,1)+1,MATCH(TEXT(TODAY(),"MMMM"),2:2,0),4),"Click for today")
(To be clear for future users, you'd need to replace the gid= number with the actual number corresponding to your sheet.)
Eric Tyler - Close. But it got me where I needed to be, so thank you so much. I was missing two key funtions: ADDRESS, and SUBSTITUTE. Here's what wound up working. (Note: In my case, the gid is 0.)
=HYPERLINK("#gid=0&#range="&SUBSTITUTE(ADDRESS(MATCH(DAY(TODAY()),A:A,1),MATCH(TEXT(TODAY(),"MMMM"),1:1,0)),"$",""),"Click here")
The ADDRESS line the way you proposed it results in the address in the format $A$1, which the HYPERLINK function doesn't like. Using that just brought be to the sheet, but not the actual cell. By using SUBSTITUTE to get rid of the $ marks, that resolved the problem.)
Thanks again!
I have already asked a similar question in another thread which was wonderfully answered by someone. However, it seems like that even if it did help, it was not 100% ok for all my GSheets and different projects. So I have been able to get more useful data from my source and I think that I would be able to have a bulletproof solution if I am able to find the good formula...
So my data looks like that:
Column A has a list separated by semicolons. Copy paste looks like that "Potato ; Banana ; Apple".
Column B has a list of IDs, which are linked to the data in column A. So Potato is ID 1871, Banana is ID 1890 and Apple is ID 1840. Copy paste of date is: "1871 ; 1890 ; 1840"
Column C should output formula with the value "Banana", because his ID is the highest of all (1890 > 1871 > 1840).
I have tried a lot of different things. Overall I tried to SPLIT the values with " ; " and create one array where I would try to sort them from the column or row where the IDs would be. I wasn't sure how to merge both results...
I tried to study the ARRAYFORMULA() function to see if it would help. gSheets is very nice to work with, but I come from a world of PHP where I would write 7 lines of code to achieve my goals, where here I need to do only 1 line of code and it is a challenge for me.
Any help is appreciated to find the formula in cell C1 that would get the value from A1 that has the highest ID in B1.
=ARRAYFORMULA(HLOOKUP(MAX(TRIM(SPLIT(B1, ";"))*1),
{TRIM(SPLIT(B1, ";"))*1; TRIM(SPLIT(A1, ";"))}, 2, 0))
I have 3 rows in my Google sheet, that is stock, price, and total. so, I just use "multiple" formula for stock and price then put the value into the total row. but I don't want total row get an update or change the value whenever I change stock value.
Can someone help me?
Assuming you want cell A1 to only calculate its value once, you can put the following in cell A1. This tells the cell to just use its existing value if there is one (and it's not 0), otherwise run the formula.
=IF(A1<>0, A1, formula())
Since the cell is referencing itself, you will need to enable iterative calculation in File > Spreadsheet settings > Calculation.
I use something like the following for historical Google Finance data, since the value is never going to change, and sometimes Google Finance randomly returns an error. This will only run the GOOGLEFINANCE() formula until it returns a non-zero value without erroring.
=IF(IFERROR(A1)<>0, A1, GOOGLEFINANCE(...))
Google Sheets is not build to operate in such a manner. The most simple and fastest solution is to calculate what you need and then use CTRL + C and repaste with CTRL + SHIFT + V
use the copy paste value option per https://www.ablebits.com/office-addins-blog/google-sheets-convert-formulas-values/
Initially I was going with Grayson's solution, but this
=IF(IFERROR(A1)<>0, A1, GOOGLEFINANCE(...))
Places a FALSE on the cell until the result is placed.
I needed that to be empty, i.e. "" as whatever different from that (cell <>"") would trigger another cell to do another query/request.
I also needed the formula to be run depending on the trigger (the url in another cell). In this formula, if the trigger is placed after the formula has run, it won't trigger it.
So I have something like
=IF(AND(IFERROR(E53)<>0,E53<>""),E53, if(D53<>"",IMPORTDATA(D53),""))
<Update 2022-11>
While using this in arrayformula I noticed something that could be wrong.
IFERROR(E53)<>0 # Doesn't make sense.
It should be
NOT(ISERROR(E53))
And the whole thing in arrayformula (careful with AND/OR )
=ARRAYFORMULA( IF( NOT(ISERROR(E2:E)) * (E2:E<>"") ,E2:E, 'SOMETHING ELSE' ) )
I leave both versions in case someone spots errors in any of them.
<End of update 2022-11>
Explanation (It took me a while to understand it, so I could extend it):
D53 = myself
If I am nothing ("") or I am in Error (importdata not yet completed)
then
I am the result of -> If(D53<>"",IMPORTDATA(D53),"")
Which is:
If the cell before me is something different from "", run the importdata
with that cell as url, otherwise I am "" (nothing)
This achieves the goal of running the formula only once if the trigger is valid (the url on the cell before is there). Once the result is placed, it won't change.
If for whatever reason you need it to run again, you have to remove the formula and place it again.
Notes: If cellX has the result of an external fetch (IMPORTDATA for example) and on cellY=cellX, while on cellX you see "Loading ..." on cellY you will see a 0 (zero). I believe that explains why the other solution was comparing with 0.
I'm writing a spreadsheet for a planning of some sort. It is about a band with multiple musicians on sometimes the same instruments. I've made two sheets. One for the musicians to let them show when they'll be present, while the other has to make an overview of all musicians present on certain dates.
I've already made an if statement to show when one of them is present, which would look like this in simple code:
if(B2)
print("Eric")
What I actually would want is an if statement to show when they are both present. In simple code it would look like this:
if(B2)
print("Eric")
if(B2 && C2)
print(", ")
if(C2)
print("Frank")
Really simplified.
I've made an example spreadsheet to show what I've already got. Here it is:
https://docs.google.com/spreadsheets/d/17gyoh5NUdiUWB_Nq0w3FAc1OsWQygzRYd_kzm0ijdJA/edit?usp=sharing
So what I would like to see with input as: B3=TRUE, C3=TRUE.
in sheet2 it should then show in B3: Eric, Frank
How about this answer? I think that there are several answers for your situation. So please think of this as one of them.
Sample formulas:
Please put 1st and 2nd formula to "B3" and "C3" of Sheet2, respectively.
=TEXTJOIN(", "; TRUE; ARRAYFORMULA(IF(Sheet1!B3:C3=TRUE; Sheet1!$B$2:$C$2;)))
and
=TEXTJOIN(", "; TRUE; ARRAYFORMULA(IF(Sheet1!D3:G3=TRUE; Sheet1!$D$2:$G$2;)))
Retrieve values that the checkbox is checked using IF and ARRAYFORMULA().
Join the retrieved values using TEXTJOIN().
Result:
For example, when B3, C3, E3 and F3 of Sheet1 are checked, Sheet2 becomes as follows.
References:
ARRAYFORMULA
TEXTJOIN
If I misunderstand your question, I'm sorry.
Greeting
I'm sorry for the intrusion, but I have a question that seems no one asked before.
I want to know if there is a formula for Conditional Formatting in spreadsheet to highlight certain cell, if a duplicate of certain text came in sequence in the same row.
A B C D E F
26 27 28 29 30
deni V X X V X
In the above example, I want to highlight the name "deni" when there are 2 "X"'s that came in sequence, which was the case at the 27 and 28 date.
Is there any formula for this? I have tried =OR(B2=C2,C2=D2) but it only works for 2 cells (B2&C2) with any text (not the "X" only).
Here is an example of the spreadsheet
PS: i'm sorry, i used excel tag before. but i need this formula to work in google spreadsheet. my bad, sorry
Conclusion: My Question have been answered, i used both formulas from I'-'I and Tom Sharpe and it worked like a charm. Many thanks to the people that responded My Question :)
=SUMPRODUCT((D2:AG2="x")*(E2:AH2="x"))
Apply to:
A2:A
Also
=countifs(D2:AG2,"x",E2:AH2,"x")
If you want to check if there is a duplicate text (not the "X"), you can use:
=IF(SUM(COUNTIF(D2:AH2,D2:AH2))>COUNTA(D2:AH2),1,0)
1 means true, 0 means false. This is because if there is at least one duplicate text, the sum of all the texts' appearance times will greater than the count of all the texts (if not they will be equal).
To be highlight a certain cell, here is deni, you can use Conditional Formatting -> Highlight Cell Rules -> More Rules -> use a formula to datemine which cells to format, and then paste the formula above in the cell.
Step1:Select the range of cells you want to apply conditional formatting to.
Step2:On the Home tab, click Conditional Formatting.
Step3:Point to Highlight Cells Rules, Go on More Rules...
Step4:Choose Use a formula... Paste the following one,
=SUMPRODUCT(COUNTIF(C3:G3,C3:G3)-1)>0
Step5:Format how you want to highlight
Step6:Click OK and Apply
Hope this helps you.
Note: Change the range in the formula as per your data.