I have a google sheet with some contact info. Where some categories like 'promotion team', 'creative team'. I have created another sheet, and imported that information, put names under the category.
I have given a formula like this -
=IF(EXACT("Promotion & Marketing",Sheet1!E2), Sheet1!A2, " ")
but some line remains blank, how I can check, if this if statement false, then skip the line, don't leave it blank
You can filter the content of A column.
I can't see your exact data so my answer may be not super precise but I think of something like that:
=filter(Sheet1!A2:A,Sheet1!E2:E="Promotion & Marketing")
This formula should display all the cells from A2:A range when there's "Promotion & Marketing" in corresponding row of E2:E column. With no blank rows.
Related
I'm using the =IMPORTRANGE formuala to pull values from another spreadsheet and represent them in a comparison chart on another sheet. Here is the formula below.
=IMPORTRANGE("the link to my doc is here", "Wed. HEADCOUNT!C2")
^^^ this formula currently works. What I'd like to do is replace C2 with "currentcell" but this breaks the formula. I need to do this to repaste the formula hundreds of times without having to individually change each one.
Any thoughts?
I've tried putting in "currentcell", but this led to #REF error.
You can create a "virtual" reference to your current cell by using CELL("address",C2), which returns the address "C2", and then C2 will move when you copy the cell to another location.
So your formula will be this:
=IMPORTRANGE("the link to my doc is here", "Wed. HEADCOUNT!" & CELL("address",C2))
I have a Google sheet with answers to a form, and I created a template in Google Sheets to transform each row in the answers sheet in a report, using vlookup (=PROCV in portuguese). The last column in the spreadsheet is a link for an image, uploaded by who answered the form.
The vlookup is working fine, except for the image. It's not displaying the image in the cell.
I have tried:
=image(PROCV(H7;'Respostas ao formulário 1'!1:630;21))
It returns a blank cell.
and also
=IMAGE("https://drive.google.com/uc?export=download&id="&INDEX(SPLIT(PROCV(H7;'Respostas ao formulário 1'!1:630;21),"="),1,2))
and
=IMAGE("https://drive.google.com/uc?export=download&id="®EXEXTRACT(PROCV(H7;'Respostas ao formulário 1'!1:630;21),"id\=(.+)"))
which I found here in stackoverflow, in another question about this issue, and return an "ERROR".
Also important, I've already changed permissions in the image (anyone with the link can access).
Any insights, please?
Thank you in advance for your time and attention.
If http://drive.google.com/uc?export=download&id={file_id} does not work, try this format:
Link Format:
http://drive.google.com/uc?export=view&id={file_id}
Try this publicly available image:
http://drive.google.com/uc?export=view&id=1YEpZitKgY6YT0TMDvOX4uqoxD5_aTuEv
Raw link image formula;
=image("https://drive.google.com/uc?export=view&id=1YEpZitKgY6YT0TMDvOX4uqoxD5_aTuEv")
Formula using regexextract to get file ID:
=Image("http://drive.google.com/uc?export=view&id="®EXEXTRACT(VLOOKUP(H7,'Respostas ao formulário 1'!1:630,21),"id\=(.+)"))
Outputs:
Vlookup output:
http://drive.google.com/uc?export=view&id=1YEpZitKgY6YT0TMDvOX4uqoxD5_aTuEv
Regexextract output:
1YEpZitKgY6YT0TMDvOX4uqoxD5_aTuEv
Raw link image output:
Image regexextract output:
Note:
If the image is still not showing, there is an issue with your link and it may not be available to anyone else. To confirm this issue, open the link in incognito mode. If it shows, it is publicly available. If not, then it isn't and the image will not show using IMAGE formula.
Make sure the one you append to the link format is only the ID and nothing else.
See sample sheet
EDIT:
It seems your lookup ID contains #, add a backslash before it by using the below formula
Formula:
=Image("http://drive.google.com/uc?export=view&id="®EXEXTRACT(VLOOKUP(regexreplace(H7; "#"; "\#");'Respostas ao formulário 1'!1:630;21);"id\=(.+)"))
Try setting the "is_sorted" parameter to false. From your first formula I gather you are looking up the value in H7 against the sheet 'Respostas ao formulário 1' rows 1 through 630 and you want the 23 column (W). Some areas that can give you problems is setting the sort to false, so it has to be an exact match, is the lookup value in the first column of the resource sheet?
Essentially with a format matching this you shouldn't have any issues:
Sheet named 'Respostas ao formulário 1'. Notice I have hidden columns B:V to consolidate the image and only show important information.
Finally the formula sheet:
We are looking up the value in cell F1 "Value1" against the second sheet and returning the image from the link.
I'm importing into Google Sheets with IMPORTXML with the following XPATH:
=IMPORTXML(A2;"//*[#id='mw-content-text']/div/table[1]/tbody/tr[4]/td[1]/ul/li")
A2 containing the URL (https://stt.wiki/wiki/20th_Century_Pistol).
From the website I want to import the list entries in the "Basic" column and "Crafted From" row of the table.
There are only two list entries in this section of the table:
"x1 Basic Security Codes" and
"x4 Basic Casing"
Therefore, I expected to get only those two list entries as rows in my sheet.
Instead, I got an additional blank row above those two entries. When I change "td[1]" to "td[3]" in the XPATH query however, there are no extra blanks.
I don't understand where the additional blank row is coming from and how I can avoid it.
Google Sheet with desired and actual result
When I saw the HTML of the URL, there are 2 li tags in the ul tag. So I think that your xpath is correct. But from your issue, I was worry that the sup tag might affect to this situation. But I'm not sure whether this is the direct reason. So I would like to propose to add the attribute of li for your xpath as follows.
Modified xpath:
When your xpath is modified, please modify as follows.
From:
//*[#id='mw-content-text']/div/table[1]/tbody/tr[4]/td[1]/ul/li
To:
//*[#id='mw-content-text']/div/table[1]/tbody/tr[4]/td[1]/ul/li[#style='white-space:nowrap']
By adding [#style='white-space:nowrap'], the value of li with style='white-space:nowrap' is retrieved.
Result:
The formula is =IMPORTXML(A1;"//*[#id='mw-content-text']/div/table[1]/tbody/tr[4]/td[1]/ul/li[#style='white-space:nowrap']"). Please put the URL to the cell "A1".
Note:
Also, you can use the xpath of //*[#id='mw-content-text']/div/table[1]/tbody/tr[4]/td[1]/ul/li[position()>1].
To complete the very neat #Tanaike's answer, another expression :
=IMPORTXML(A2;"//th[contains(.,'Crafted')]/following::td[1]//li[contains(#style,'white')]")
If a blank line is added it's because GoogleSheets parses an additional blank li element containing a #style attribute.
I have a text file named data.txt having various parameters such as number, status and so on.
Each line contains a different set of data.
Now, in my GUI, I have submit button. On click of that button, I want 'few' of these data to be displayed as a table on the GUI screen
One thing is I do know which position it exists in the text file :
Ex: Status appears at position [70..78] in each line of text file
Number appears at position [85..90] in each line of text file and so on
I want only those particular parts of data to be displayed in respective columns of the table
Any suggestions would be welcome. I am using Qt and Ruby for my GUI design
Following images show what exactly i am looking for:
EDIT: Using the solution mentioned by Stephen:
Using the line position worked for me. But one query here, when i try to use that using puts statement, it does print properly. However when i try to use the same for displaying it inside TextEdit widget, each line does not get displayed..
#text_var = "#{line[70..78]}\t#{line[85..90]}
#text = Qt::TextEdit.new(self)
#text.setText (#text_var)
puts #text_var
Puts statement gives correct output, however i am not able to send the same inside the widget.
If i use break statement , then first line is getting displayed in widget correctly. So error is happening when it is trying to read line by line on to the widget. Ultimately, it is getting overwritten and last line where just blank spaces are there is getting printed in the widget i feel.
Any solutions for this ?
It looks like the Status and Number you want always appear in the same column. You can split each line of data.txt on whitespace to only display the column you want.
File.open('data.txt').readlines.each do |line|
columns = line.split(/\s+/)
puts "#{columns[4]}\t#{columns[5]}"
end
This prints the 5th and 6th columns, separated by a tab.
You could also take advantage of knowing the position, as you mention:
File.open('data.txt').readlines.each do |line|
puts "#{line[70..78]}\t#{line[85..90]}"
end
What's the formula to display an url in google sheet when part of said url is a variable from another cell?
I'll explain: in one cell I have this formula (used to scrape text with class 'description' in an html webpage, doesn't matter for the purpose of the question though)
=importXML("http://www.xxx.it/code/9788823506183/doc/book.html","//span[#class='description']")
The numerical part changes everytime based on the value in another cell, say B3.
Tried =importXML("http://www.xxx.it/code/(B3)/doc/book.html","//span[#class='description']") but of course it won't work.
Then I thought I could dinamically create the url in B2 and do like this:
=importXML("B2","//span[#class='description']")
One step closer but I'm stuck anyway, how can I generate such url in B2? I can't find a suitable function in the docs. I could only come up with:
in A1 = 9788823506183
in B2 = http://www.xxx.it/code/("A1")/doc/book.html but it's not the correct syntax. :(
In Excel, you'd do something like the following. Give it a try in a google spreadsheet.
=importXML("http://www.xxx.it/code/" & B3 & "/doc/book.html","//span[#class='description']")
Use CONCAT in Google Sheets.
=CONCAT("http://www.xxx.it/code/(", $B2,")/doc/book.html")
You may need a formula to get the exact spot in the string.
The following example starts a timer based on a cell value but could be adapted to build a URL out of any cell values. Assume that there is a number of minutes that you want to make a timer for is in $C20
1) Make a cell that builds the first part of the URL, in my case $E27:
=CONCAT("https://www.google.com/search?q=set+timer+for+", $C20)
2) Make a second cell that completes the URL, in my case $E28:
=CONCAT($E27,"+minutes")
3) Make a cell that contains a hyperlink that will call up the timer:
=HYPERLINK($E28, "Start a timer for cell value C20")
Then when you click on the cell you made in #3 a hyperlink will hover over and you can click on it.