I have a power query that is making an api request with some value in a column as a parameter. Normally in Excel, you would say something like =A1 then drown the cell down and get a response from A2, A3, etc. How do you do this with powerquery? Here is my function so far but it only takes the first result of the column.
Json.Document(Web.Contents("API?symbol=" & Source{0}[Column1] ))
The code Source{0}[Column1] says to take the first row of Column1 of the table Source (which I'm assuming is the name of the first step in the query).
Instead of referencing a row and column of an entire table, you can probably just use [Column1], which should refer to the value in the current row. Try this as the formula for a new custom column instead:
Json.Document(Web.Contents("API?symbol=" & [Column1] ))
Related
I have a Power Query table that updates on a regular basis. The table has columns named "Volume Third Party_some number". After the update, the number of the column with this name may increase or decrease. At the end of the table, there is a calculated column that has the formula to subtract from the last column with the name sum of the columns with the name written above.
In the power query editor, I couldn't find any formula which would help me to get the last column with the name, so instead, I'm trying to create a dynamic SUM function/sub procedure that would get the last column with the name "Volume Third Party_some number".
I have attached a screenshot
and from it, you can see there is a column "Volume Third Party_47" and column "Volume Third Party_48". After the update "Volume Third Party_48" was added but the SUM function is referring to the values from the column "Volume Third Party_47". So instead I need a function/sub procedure in VBA which would change the reference to the last column in the formula, in this case to the column "Volume Third Party_48" and also put a filter to a new reference column (it should remove 0 & blank values), while deleting it from another one.
Any ideas on how to make this VBA code?
This can be made possible using some change in excel formula.
If the name of you table is Table1 and the first column header of your table is firstColumn, then you need to replace [#[Volume_Third_Party_47]] in your formula with
OFFSET([#[firstColumn],,COUNTA(Table1[#Headers])-2)
But you entire formula should be something like this:
=IFERROR(
OFFSET([#Column1];;COUNTA(SAPCrosstab_UA[#Headers])-3)-
SUM(
OFFSET([#[Volume Third Party]];;;;
(COUNTA(SAPCrosstab_UA[#Headers])-1) -
MATCH("Volume Third Party",SAPCrosstab_UA[#Headers],0)
)
);
"")
I have a table of data in excel which has Time, Name, and Result columns.
My goal is to use formulas to generate a different, new table which shows the results for each Time (column) and Name (row) combination. This will later be used to generate a heatmap (the results are real numbers).
I am doing this by using a formula on each cell of the new table. An example from cell K5 in the new table is below:
=INDEX($AE$2:$AE$999, MATCH(1, INDEX(($A5=$X$2:$X$999)*(K$4=$V$2:$V$999),0,1),0))
Where $AE$2:$AE$999 is the Result column, $A5 is a name row in the new table, $X$2:$X$999 is the Name column, K$4 is a time column in the new table, and $V$2:$V$999 is the Time column.
The problem is that my table of data has multiple entries that have identical Name and Time combinations, but differing Result values. For these combinations, I would like for the formula to return the average of all nonzero results.
I think the current formula only returns the first match it runs into. I would like for this process to be autmated as possible as the original table of data will be changed frequently.
Screenshot showing the two tables.
The new table. The formula shown in G6 returns 0. I would like for it to return the average of 3.1 and 2.6.
One note: The text of your question is different from the images. I'm going to use the columns mentioned in the text of your message rather than the columns in the images.
It looks like what you're doing is calculating an average but only under certain conditions. Since you're working with multiple conditions, you would start by looking at the formula AVERAGEIFS().
In your case, for Cell G5, You want the average if any row in column X is India (A5) and that same row in column V is 6 (G4) and that same row in column AE is not zero.
So, at its base, the formula in G5 would look like this:
= AVERAGEIFS( $AE$2:$AE$999
, $X$2:$X999, "=India"
, $V$2:$V$999, "=6"
, $AE$2:$AE$999, "<>0" )
However, you want it to be both dynamic and flexible, to do that and keep Excel from messing with things as I move cells around, I make extensive use of the ROW() AND COLUMN() functions.
I think the final might look something like this
= AVERAGEIFS( $AE$2:$AE$999
, $X$2:$X$999, "=" & INDEX( $A:$A, ROW() )
, $V$2:$V$999, "=" & INDEX( $4:$4, 1, COLUMN() )
, $AE$2:$AE$999, "<>0" )
This can be pasted as is in any of the cells from B5 the the right and down, and should give you want you want in each cell. The formula will give you an error if the combination in the axes doesn't exist in the results table. So, you should wrap the whole thing in an error function and display what you want when that happens.
For reference
INDEX( $A:$A, ROW() ) Gives you the label in column A for the row in which the formula resides. So, for any cell in Row 5, this is "India".
INDEX( $4:$4, 1, COLUMN() ) gives you the label in row 4 for the column in which the formula resides. So, for any cell in column G, this will be "6".
If you hace Excel Version 365, the Dynamic Array functions make this simple
Times formula
=TRANSPOSE(SORT(UNIQUE(FILTER(U:U,(ROW(U:U)>1)*(U:U<>"")))))
Names Formula
=SORT(UNIQUE(FILTER(W:W,(ROW(W:W)>1)*(W:W<>""))))
Table formula
=IFERROR(AVERAGEIFS(AD:AD,AD:AD,">0",U:U,C4#,W:W,B5#),"")
If you don't have 365, then the table formula can be
=IFERROR(AVERAGEIFS($AD:$AD,$AD:$AD,">0",$U:$U,C$29,$W:$W,$B30),"")
and copied to the extents of the table. Create the header row/column by any means you choose
I am trying to index match some data into a table but as there are multiple matches Im not getting the match i need which would be the match with the largest value.
I have tried using maxif and lookup but had no luck as of yet with getting it to work.
One table has item number only, the next has item number, price and quote date but the same item can have up to 10 rows with different pricing/dates.
I'd like to pull in the most recent quote date with the item in table 1.
Any help would be much appreciated!!
I tried this concept before like this...
First approach:
I added a column which has the following formula (assuming that id in B:B) (put this formula in D:D column)
=A1 & "-" & countif(A2:A$999,A1)
for the childs table so i made custom index for every single row
and then in the master table (assuming you want to show the value of C:C)
=INDEX(Sheet1!C:C,MATCH(A1&"-0",Sheet1!D:D,0))
Second approach:
will be to use the new MAXIFS formula but you will need a newer excel version
for this approach you will need a sequent index column which just has the row number 1,2,3
and then use this formula:
=INDEX(Sheet1!C:C,MAXIFS(Sheet1!A:A,Sheet1!B:B,A1))
I've simplified a problem, where I have a sheet with 80,000+ rows and another sheet that is an index of sorts:
I need to structure a formula where, I need to pull the value in the second table, for a it would be 1 and so forth into the first table. I've tried:
=IF(VLOOKUP(A2, Table1, 1, 0), E2, "") but I get an #N/A error. I am not sure how to go about structuring this formula in a different way. I need to look up the value in the first Table, see if the value exists in the second table, and if it does, pull the corresponding value back into the first table
Assuming:
your first table is in A:B
your second table is in D:E
You can use this on B2 and drag:
=IFERROR(INDEX(E:E,MATCH(A2,D:D,0)),"")
Try:
=IFNA(VLOOKUP(A3,$I$3:$J$8,2,FALSE),"")
Results
I have an excel document with two sheets, data and edu-plan. The sheet data has the following information:
The sheet edu-plan looks like this:
My question is: how do i create an excel formula that checks if the target group on the specific row in edu-plan! has the course name in question on the same row as the target group in sheet data!, i.e. if Sales and Sales course is on the same row in the sheet data!?
In reality, the data sheet as a couple of hundred rows and will change over time, so i am trying to develop a formula that i can apply easily on all rows/columns in edu-plan!.
The desired result in edu-plan would look like this:
A pivot table might be a good way to go.
If you would like to do it by formula, then you can just use a COUNTIFS
=IF(COUNTIFS(data!$A$2:$A$10,$A2,data!$B$2:$B$10,B$1),"X","")
A possible way to solve your issue with an array formula:
Write in B2 of sheet edu-plan
{=IFERROR(IF(MATCH('edu-plan'!$A2&'edu-plan'!B$1,data!$A$2:$A$6&data!$B$2:$B$6,0)>0,"x",""),"")}
Since it is an array formula, you need to hit shift + ctr + enter.
Here is the formula broken down:
MATCH('edu-plan'!$A2&'edu-plan'!B$1,data!$A$2:$A$6&data!$B$2:$B$6,0)
checks whether the combination of row header and column header is in the data table. MATCH returns the index of the found combination. Since we are not interested in the location, we only ask IF(MATCH > 0, "x", "") to write an "x" if a match was found. If MATCH finds nothing, it returns an error, which is why we add an IFERROR(VALUE, "") around the construct.