How do I refine the results of an importXML function? - excel

I'm making a spreadsheet to try and help track peoples heart of azeroth levels, and I've got my cell set as
=IMPORTXML("https://worldofwarcraft.com/en-gb/character/Zenedar/Father","//*[#class='GameIcon-level']")
however it seems to return the number 36 twice, once in the cell I want and another in the cell below, how do I refine this to a single cell of '36'

How about these modifications? In this modification, it adds the parent node.
Modified formula 1:
When you want to retrieve 1st value of 2 values, you can use this.
=IMPORTXML(A1,"//div[#class='CharacterProfile-item']//*[#class='GameIcon-level']")
Modified formula 2:
When you want to retrieve 2nd value of 2 values, you can use this.
=IMPORTXML(A1,"//div[#class='List-item']//*[#class='GameIcon-level']")
Note:
You can also use div[#class='GameIcon-level'] instead of *[#class='GameIcon-level'].

Related

VLOOKUP Multiple Columns If Not Found In First Column

I have a long list of part numbers where I need to be able to lookup and retrieve information on them.
These parts can have several alternative part numbers. I have figured out how to get the data returned if my data table only shows one of the possibly part numbers.
The issue is that I want it to be able to look up the columns to find a matching value.
As in the picture below for example. 5-E26 is the equivalent to E5-25. So if I input 5-E26 in the cell, I want it to continue searching to find the value in B7, and return the data as done A4 and A5.
Is this possible to do with Vlookup? Or is there a smarter method for it?
I struggle to fully understand how your data works but here is a possibility:
So the translated version of the formula I used in G2:
=INDEX($D$1:$D$5,AGGREGATE(15,3,((($A$2:$D$5=F2)/($A$2:$D$5=F2))*ROW($A$2:$A$5)),1))
You could also try (in my case):
=INDEX($D$1:$D$5,SUMPRODUCT(($A$2:$D$5=F2)*ROW($A$2:$D$5)))

Test whether a value in a cell matches another value in an array, and do an action if a match is found

I am trying to create a formula that will look at a cell and test the value in that cell against an array or multiple arrays of cells, and if a match is found, take another action like calculate a mathematical formula.
Really the action taken afterwards is not the issue, just used as a reference of what I ultimately intend to do with the formula. The biggest hurdle I am having is the first part of the formula where I need to test values.
I need to test the employee ID's in column W against the same employee ID's located in the "doors" columns and see if there is a match, and if there is, do another action.
Formulas I have tried, though I really don't know what I should be doing here:
{=IF(W5=T4:T7,"true")}
{=IF(OR(F4:F7,H4:H7,J4:J7,L4:L7,N4:N7,P4:P7,R4:R7,T4:T7)=W6,"True")}
Any help would be appreciated. Please let me know if I need to elaborate.
Use MATCH for one column:
=IF(ISNUMBER(MATCH(W6,$T$4:$T$7)),X6/5000*1000000,0)
For multiple columns:
=IF(ISNUMBER(AGGREGATE(15,7,ROW($B$4$:$T$7)/($B$4$:$T$7=W6),1)),X6/5000*1000000,0)

How do I display all my results for a specific search. When the specific search has multiples results. Not using vLookup

I have a sheet with 2 columns. ID and SearchTerm
ID has the same ID# for multiple SearchTerms.
I am trying to search for example ID# 25 and then be able to show all results on a separate sheet. Without having to search for the ID number and then Copy and Paste the columb.
I tried doing a vLookup, but it only gives me back the first SearchTerm based on the ID.
For only 7225 rows of data, an array formula isn't too bad, speed-wise (enter it as an array formula with Ctrl+Shift+Enter in a range that is 100 rows long and one column wide):
=INDEX(B1:B7225,SMALL(IF(A1:A7225=4,ROW(A1:A7225)),ROW(INDIRECT("1:100"))))
Change the 4 to the desired search value (or a cell with the desired search value). You can get more/less than 100 results by changing the 100.
I just tested it against a non-array version that you fill down, e.g.,
=INDEX(B1:B7225,AGGREGATE(14,6,ROW(B$1:B$7225)/((A$1:A$7255)=4),ROW(A1)))
and the array version is more than an order of magnitude faster.
Lets assume your search ID in in E4 and you want your search results to be in F4:F21. In F4 place the following formula and copy it down the maximum number row you think you might have.
=INDEX(B:B,AGGREGATE(14,6,ROW(B$1:B$7225)/((A$1:A$7255)=E4),ROW(A1)))
I was going to put a caveat in about don't use full column references within the AGGREGATE function because it performs array calculations and will slow things down, but I believe Scott Craner's comment covered that.
Having said all that I believe using filters is the faster approach.
UPDATE
In order to avoid errors from being displayed, wrap the whole thing in an IFERROR function:
=IFERROR(INDEX(B:B,AGGREGATE(14,6,ROW(B$1:B$7225)/((A$1:A$7255)=E4),ROW(A1))),"")

Excel: Look up specific value over an array and then count the number of items in specific column

This is my first post and am only creating this post after not being able to find my specific issue. I am trying to count specific items in a certain column if that column has a specific heading.
Example: My work has an Excel file that different team members mark once they've completed a specific task. I then have a table on another spreadsheet that updates how many tasks a specific team member has completed. The team members have to make these marks every quarter.
The above image best illustrates what I mean. I would like the COUNTIFS function to automatically update based on cell A15; IE when i change the date, the counter will update for the corresponding column. Right now, I manually adjust the criteria range for every period. I know there must be a way to tie to cell A15 so when I change the cell value, everything else updates automatically. I just can't figure out how to do it. Hopefully someone can help!
Thanks.
You can look up the index of the column using MATCH and use that to offset the range. For example:
The formula in my example is =COUNTIF(OFFSET(A2:A7, 0, MATCH(A9, A1:C1, 0)-1), "=x"). For you I would use =COUNTIF(OFFSET(A3:A12, 0, MATCH(A15, A2:E2, 0)-1), "=X").
You can do this with multiple criteria using an array formula, e.g.
=SUM(IF(IF(B1:D1=A9,IF(A2:A7=A10,B2:D7))="X",1))
Where
=SUM(IF(IF([Date Range]=[Date Criteria],IF([Team Member Range]=[Team Member Criteria],[All the Xs]))="X",1))
Remember to press Control+Shift+Enter when entering an array formula

Using SUMIFS with multiple AND OR conditions

I would like to create a succinct Excel formula that SUMS a column based on a set of AND conditions, plus a set of OR conditions.
My Excel table contains the following data and I used defined names for the columns.
Quote_Value (Worksheet!$A:$A) holds an accounting value.
Days_To_Close (Worksheet!$B:$B) contains a formula that results in a number.
Salesman (Worksheet!$C:$C) contains text and is a name.
Quote_Month (Worksheet!$D:$D) contains a formula (=TEXT(Worksheet!$E:$E,"mmm-yy"))to convert a date/time number from another column into a text based month reference.
I want to SUM Quote_Value if Salesman equals JBloggs and Days_To_Close is equal to or less than 90 and Quote_Month is equal to one of the following (Oct-13, Nov-13, or Dec-13).
At the moment, I've got this to work but it includes a lot of repetition, which I don't think I need.
=SUM(SUMIFS(Quote_Value,Salesman,"=JBloggs",Days_To_Close,"<=90",Quote_Month,"=Oct-13")+SUMIFS(Quote_Value,Salesman,"=JBloggs",Days_To_Close,"<=90",Quote_Month,"=Nov-13")+SUMIFS(Quote_Value,Salesman,"=JBloggs",Days_To_Close,"<=90",Quote_Month,"=Dec-13"))
What I'd like to do is something more like the following but I can't work out the correct syntax:
=SUMIFS(Quote_Value,Salesman,"=JBloggs",Days_To_Close,"<=90",Quote_Month,OR(Quote_Month="Oct-13",Quote_Month="Nov-13",Quote_Month="Dec-13"))
That formula doesn't error, it just returns a 0 value. Yet if I manually examine the data, that's not correct. I even tried using TRIM(Quote_Month) to make sure that spaces hadn't crept into the data but the fact that my extended SUM formula works indicates that the data is OK and that it's a syntax issue. Can anybody steer me in the right direction?
You can use SUMIFS like this
=SUM(SUMIFS(Quote_Value,Salesman,"JBloggs",Days_To_Close,"<=90",Quote_Month,{"Oct-13","Nov-13","Dec-13"}))
The SUMIFS function will return an "array" of 3 values (one total each for "Oct-13", "Nov-13" and "Dec-13"), so you need SUM to sum that array and give you the final result.
Be careful with this syntax, you can only have at most two criteria within the formula with "OR" conditions...and if there are two then in one you must separate the criteria with commas, in the other with semi-colons.
If you need more you might use SUMPRODUCT with MATCH, e.g. in your case
=SUMPRODUCT(Quote_Value,(Salesman="JBloggs")*(Days_To_Close<=90)*ISNUMBER(MATCH(Quote_Month,{"Oct-13","Nov-13","Dec-13"},0)))
In that version you can add any number of "OR" criteria using ISNUMBER/MATCH
You can use DSUM, which will be more flexible. Like if you want to change the name of Salesman or the Quote Month, you need not change the formula, but only some criteria cells. Please see the link below for details...Even the criteria can be formula to copied from other sheets
http://office.microsoft.com/en-us/excel-help/dsum-function-HP010342460.aspx?CTT=1
You might consider referencing the actual date/time in the source column for Quote_Month, then you could transform your OR into a couple of ANDs, something like (assuing the date's in something I've chosen to call Quote_Date)
=SUMIFS(Quote_Value,"<=90",Quote_Date,">="&DATE(2013,11,1),Quote_Date,"<="&DATE(2013,12,31),Salesman,"=JBloggs",Days_To_Close)
(I moved the interesting conditions to the front).
This approach works here because that "OR" condition is actually specifying a date range - it might not work in other cases.
Quote_Month (Worksheet!$D:$D) contains a formula (=TEXT(Worksheet!$E:$E,"mmm-yy"))to convert a date/time number from another column into a text based month reference.
You can use OR by adding + in Sumproduct. See this
=SUMPRODUCT((Quote_Value)*(Salesman="JBloggs")*(Days_To_Close<=90)*((Quote_Month="Cond1")+(Quote_Month="Cond2")+(Quote_Month="Cond3")))
ScreenShot
Speed
SUMPRODUCT is faster than SUM arrays, i.e. having {} arrays in the SUM function. SUMIFS is 30% faster than SUMPRODUCT.
{SUM(SUMIFS({}))} vs SUMPRODUCT(SUMIFS({})) both works fine, but SUMPRODUCT feels a bit easier to write without the CTRL-SHIFT-ENTER to create the {}.
Preference
I personally prefer writing SUMPRODUCT(--(ISNUMBER(MATCH(...)))) over SUMPRODUCT(SUMIFS({})) for multiple criteria.
However, if you have a drop-down menu where you want to select specific characteristics or all, SUMPRODUCT(SUMIFS()), is the only way to go. (as for selecting "all", the value should enter in "<>" + "Whatever word you want as long as it's not part of the specific characteristics".
In order to get the formula to work place the cursor inside the formula and press ctr+shift+enter and then it will work!
With the following, it is easy to link the Cell address...
=SUM(SUMIFS(FAGLL03!$I$4:$I$1048576,FAGLL03!$A$4:$A$1048576,">="&INDIRECT("A"&ROW()),FAGLL03!$A$4:$A$1048576,"<="&INDIRECT("B"&ROW()),FAGLL03!$Q$4:$Q$1048576,E$2))
Can use address / substitute / Column functions as required to use Cell addresses in full DYNAMIC.

Resources