Currently I am using a transpose and then another column to count the results and give me what I want. But because Tanaike is awesome and helped me on another section, I am trying to wrap my head around what he did and apply it to this.
Starting with this URL in A1,
https://www.zillow.com/homedetails/307-N-Rosedale-Ave-Tulsa-OK-74127/22151896_zpid/
This is the formula in A2:
=If($A$1:A="","",Transpose(importxml($A1:$A,"//span[#class='snl phone']")))
Based on the listing sometimes there are three phone numbers, sometimes four, and sometimes eight that get spread across as many columns as needed.
I am looking for the Property Owner phone number. This is the ELEMENT from the inspection.
<div class="info flat-star-ratings sig-col" id="yui_3_18_1_2_1506365934526_2361"> <span class="snl name notranslate">Property Owner</span> <span class="snl phone" id="yui_3_18_1_2_1506365934526_2360">(918) 740-1698 </span> </div>
So I tried this, and it comes up content is empty. I was thinking to look at the div class info flat, then within that the snl phone, and stop before the /end of span.
=importXML(B17,"//div[#class='info flat-star-ratings sig-col']//span[#class='snl phone']/#span")
What I really need is ONLY the property owner phone number with 95% or greater accuracy.
How about this modification of XPath query?
Modified XPath query :
=importxml(A1,"//div[#class='info flat-star-ratings sig-col']//span[#class='snl phone']")
Result :
If this is not data you want, I'm sorry.
Edit :
4th and 8th number are the same. Is my understanding correct? If it's no problem. Please put URL and a following formula to "A1" and "A2", respectively.
=QUERY(ARRAYFORMULA(IF(IMPORTXML(A1,"//div[#class='info flat-star-ratings sig-col']//span[#class='snl name notranslate']")="Property Owner",IMPORTXML(A1,"//div[#class='info flat-star-ratings sig-col']//span[#class='snl phone']"), "")),"Select * where Col1<>''")
Result :
Related
I have one spreadheet that includes name, id and amount of numbers data in it and i want to make the report in other spreadsheet.
i want to count the name column that is not blank, so i type this
=COUNTIF(importrange("gsheet link","Payroll 16-31 Jan!B3:B"),"<>")
but the result is "1" in fact that there are 3670 names on the column
=COUNTIF(importrange("gsheet link","Payroll 16-31 Jan!B3:B"),"<>"&"")
but still not working
can someone help?
I want to get the exact calculation of those data
Two things: have you connected the spreadsheets? If not, use IMPORTRANGE outside COUNTIF, something like =importrange("gsheet link","A1") . Accept the permissions and see if COUNTIF now does it right
If it doesn't, try with COUNTA that is specifically defined for counting non blank cells:. =COUNTA(importrange("gsheet link","Payroll 16-31 Jan!B3:B"))
Imported columns with title Total can change their position, only the first column always remains in the same place:
The formula used:
=IMPORTXML("https://int.soccerway.com/matches/2021/02/06/england/premier-league/aston-villa-football-club/arsenal-fc/3344352/"&"head2head/",
"//div[#class='block_h2hsection_team real-content clearfix ']//table[#class='table compare section-dropdowns']//option[#selected='selected'] |
//div[#class='block clearfix block_h2h_general_statistics-wrapper body-table header-wrapper']//tr")
1 - I need to use only one function IMPORTXML because the spreadsheet is already at the limit so as not to collapse due to several imports.
2 - The Home and Away columns are of no use to me, so I would like to exclude them to take up less space.
3 - I tried to use the QUERY function to try to select, but I can only do this if the words Total were on the first row of the imported data and also if the first column was always the same word, but that doesn't happen either, the Premier League - 2020/2021 value happens in that specific game, but in other games they are other names.
try:
=TRANSPOSE(QUERY(TRANSPOSE(IMPORTXML(
"https://int.soccerway.com/matches/2021/02/06/england/premier-league/aston-villa-football-club/arsenal-fc/3344352/"&"head2head/",
"//div[#class='block_h2hsection_team real-content clearfix ']//table[#class='table compare section-dropdowns']//option[#selected='selected'] |
//div[#class='block clearfix block_h2h_general_statistics-wrapper body-table header-wrapper']//tr")),
"where not Col4 matches 'Away|Home'"))
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 am trying to grab a list of holidays from another sheet using an HLOOKUP to find the appropriate row based on country to get a list of holidays for the NETWORKDAYS function. However, when I try to do this I simply get a #REF error that says HLOOKUP evaluates to an out of bounds range.
I have a sheet called Billable Days that has a list of holidays based on country. Cells J14:N14 contains the country, and in a list below that is a bunch of holiday dates. They are varying ranges. For example, the US holidays range from J15:J32.
In a different sheet, I need to pull the correct holidays based on the country in column R into a NETWORKDAYS function.
First I tried:
=NETWORKDAYS(B2,S1,HLOOKUP($R2,'Billable Days'!$J$14:$N$14,15:50,FALSE))
This gives me an #VALUE error saying: "An array value could not be found"
Then I tried:
=NETWORKDAYS(B2,S1,ArrayFormula(HLOOKUP($R2,'Billable Days'!$J$14:$N$14,15:50,FALSE)))
Which gives another value error.
Finally, I tried
=NETWORKDAYS(B2,S1,ArrayFormula(HLOOKUP($R2,'Billable Days'!$J$14:$N$14,{15,16,17},FALSE)))
Just to test it out to see if I could get any values, and got a #REF error that said "HLOOKUP evaluates to an out of bounds range"
Can anyone help me craft this function? I'm not even sure if HLOOKUP is the way to go here, but it was the only way that came to mind.
EDIT
For clarity and as requested, I created a sheet to demonstrate what I mean. Find it here.
You will see the Consultants and Billable Days sheets. You can see the function I wrote to calculate the NETWORKDAYS based on the start and end date. However, in that function I want to add the appropriate list of holidays from the Billable Days sheet to the NETWORKDAYS function as the third parameter. I need something that looks at the country column and finds the appropriate holiday dates from the Billable Days spreadsheet, then inserts it into the NETWORKDAYS calls. I cannot figure out how to accomplish this.
Here is how to construct what you wish.
On the consultants sheet in L2 I placed =address(2,match(E2, 'Billable Days'!$A$1:$F$1,0)), which finds the column index of the desired country and construct a proper cell name for it with row B. Then in M2 I say ="'Billable Days'!"&L2&":"&mid(L2,2,1) to construct a string referring to the desired holiday range, like 'Billable Days'!$B$2:B. Columns L and M can be dragged down for all the people. Then when you want the holiday list for the consultant in the second row say =INDIRECT(M2) or in the 5th row =INDIRECT(M5), or if you are building it into another formula, drop the = sign. You could clean it up a little to be graceful when the country is not found, or possibly to make an ArrayFormula and avoid the dragging.
I am trying to find a closest absolute value with index match. I looked at several other posts like here but what i am trying to do is a bit different as i want to add multiple search criterias.
As you can see , I am trying to get the absolute closest time for a specific person.
I am using the formula =index(C2:C21,match(F4,B2:B21,-1),match(E4,A2:A21,0)) and I had to copy column B in column C to make my 1st match work. The result is shown in G4. Unfortunately I am struggling to get the correct result.
Effectively I would like use the formula that was posted in the previous post (see link at the top) =INDEX(E2:E21,MATCH(TRUE,INDEX(ABS(D1:D21-I4)=MIN(INDEX(ABS(D2:D21-I4),,)),,),0))
with with a search criteria (the name of the person).
Any help would be much appreciated
Thank you
Thanks #avram
I still end up with some cases where the formula does not work. See below. in G6 and G7 i should get 10:25. (You can ignore column A)
Try this formula in G4,
=index(C$2:C$21, match(min(index(abs(index(C$2:C$21+(B$2:B$21<>E4)*1E+99, , )-F4), , )), if(B$2:B$21=E4, abs(C$2:C$21-F4), 1E+99), 0))
This will work in either google-sheets as a standard (non-array/non-CSE) formula or excel as an array (CSE) formula.
If anyone else wants to tackle this problem with a more elegant formula, you can copy the sample data from this publicly shared google-sheet.
Index match find closest value with multiple search criteria
Perhaps this may exempt a fourth person from retyping the same tired data that the op delivered in image(s).
A very simple approach using a "helper" column with data like:
We want the closest absolute match for larry to 10:15 AM. We enter larry in E1 and 10:15 AM in F1
Then in D2 we enter:
=IF(A2=$E$1,ABS(B2-$F$1),"")
and copy downward. (this is the absolute difference for larry) Finally in E2:
=INDEX(B:B,MATCH(MIN(D:D),D:D,0))
With bigger tables having more columns, it is very easy to add additional criteria if needed.
This answer uses Array Formulas which must be entered using CTRL+SHIFT+ENTER. It's kind of complicated, so I'll do my best to explain and will revise if necessary. Here's a screenshot:
Here is the formula in its raw form; names are entered in column A, Times in Column B.
=INDEX(B1:B7,MATCH(MIN(IF(A1:A7=D2,ABS(E2-B1:B7),"")),IF(A1:A7=D2,ABS(E2-B1:B7),"")))
As you might suspect, it uses INDEX/MATCH to get the job done, but the key is using an IF statement to generate both the search criteria and the array that the MATCH function searches within. Let's break it down.
Sec 1, Match Search Array
IF(A1:A7=D2,ABS(E2-B1:B7),"")
This creates the Search array for the match function. If the name in D2 (our criteria) is equal to the name in the search array, it return the absolute value of the difference between the criteria time and the time in the array we're searching. Otherwise it returns a blank value. Do not use 0 for this as it will skew the match result.
Sec 2, Match Search Criteria
MIN(IF(A1:A7=D2,ABS(E2-B1:B7),""))
This tells us the smallest value in the above array. We use this value as the search criteria in the MATCH function.
Sec 3, putting 1 & 2 Together
MATCH(MIN(IF(A1:A7=D2,ABS(E2-B1:B7),"")),IF(A1:A7=D2,ABS(E2-B1:B7),"")) This searches for the smallest abs difference defined in Section 2 within the array created in Section 1 and returns the row number.
Sec 4, Indexing the times
=INDEX(B1:B7,MATCH(MIN(IF(A1:A7=D2,ABS(E2-B1:B7),"")),IF(A1:A7=D2,ABS(E2-B1:B7),"")))
This returns the time value from column B in whatever row is identified by the Match function above.
Hopefully this all makes sense. Remember to enter it as an array formula.