GETPIVOTDATA and Other Worksheets - excel

I am having issues with extracting pivot table from another worksheet. I believe my syntax is wrong, but after trying several different renditions, nothing is correct.
here is what I have
=Getpivotdata('Other WorkSheet'!$A$1 "Count of SOMETHING", $A$1)
I think my issue is with the absolute cell reference in the direction to the other sheet. However my search for answers has turned up nothing.

What's wrong exactly? You don't need to type in the function, simply click the cell you want and Excel will create the function for you.

I ended up going back to the drawing board as I felt that I wasn't entering the formula in correctly. I should've posted this yesterday but I got tied down into something. The problem was how I was directing the formula to find the pivot table in question. The reference to the other worksheet should have been in the part of the formula that tells excel where the pivot table is. Here is the correct syntax:
=getpivotdata("Count of SOMETHING", 'Other Worksheet'!$A$1)
Basically I had it backwards.

Related

How can I work with excel date after exporting a file from a site

I've exported an excel file that have some column whit date in it.
when I want to work whit that column's cells(for example different between two date) excel shows me an error. but when I double click on a cell, it work properly.
you can see below that first two cells have correct value after I double clicked on them. But next three cells still don't work properly.
I will be thankful if anyone helps me.
Cells example
Based on Harun24HR's comment, you could think of a macro to deal with the situation (if the situation repeats itself over and over -> would something like this be working?
Worksheets("Sheet1").Activate Application.DoubleClick)
or manually add a neighbour column with formula in the cell such as =DATEVALUE(ThatNeighbourCell)
Also the formatting style of the cell might be relevant.
macro is such as this:
Sub doubleClickIt()
Worksheets("Sheet1").Select 'adapt name
Range("A1:A400").Activate
Application.doubleClick
End Sub
But I'm not sure it will do the trick, double clicking as a user seems to trigger different results than double clicking from the macro..
Please have a look at this question which seems very relevant to your issue, if you intend to go for a macro.

Formula error of hard-coded structured references with Excel tables

I'm trying to use structured references with Excel tables https://support.microsoft.com/en-us/office/using-structured-references-with-excel-tables-f5ed2452-2337-4f71-bed3-c8ae6d2b276e.
If I copy-paste the formula like =DeptSales[[Sales Person]:[Region]] in a cell, Excel returns an "There's a problem with this formula..." error.
One solution is to choose the Sales Person that the intellisense proposes:
I don't understand why hard-coded Sales Person is not accepted. Could anyone help?
PS: the version of my Excel for Windows:
Why dont you type = in the cell where you are putting the formula, then select the target cells with your mouse? Then it should work correctly.
I dont see the calculations that you want to do? Is it count or sum or something?
Please see my example below. It works fine.

Excel formula returning values from missing workbook

I'm having an unusual issue with Excel 2013.
There is an old Lookup formula in the workbook which is referring to another workbook. However, this workbook no longer exists and has been deleted from the server. The problem is the lookup formula still returns values when the reference cell (lookup value) is updated!
Has anyone seen this before or have any ideas why this would happen?
Here's the formula for reference
=LOOKUP(Control!AQ15,'C:\Users\xxxxxxx\Desktop\[Copy(1)NAS 16Jun15.xlsm]Articles'!B1:B82,'C:\Users\xxxxxxx\Desktop\[Copy(1)NAS 16Jun15.xlsm]Articles'!C1:C82)
No idea why they're still using Lookup, but this shouldn't happpen...
Found the answer!
I've just looked in the Advanced Options section under the "When calculating this workbook:" heading and found an option to "Save external link values".
This was ticked so I've deselected it, saved it and then reopened and the problem has been solved!

VLOOKUP function issue in VBA excel

I did a lot of research on this topic, but could not find a solution.
I created a macro to search for value and put it in the cell.
My program returns me error i.e 1004 which means data not found.
I debugged the program and found that the value, when it was fetched it was "TSK0000000788", but when I incorporated that variable in the VLOOKUP function it changed it to "TSK788".
I also tried to change the format of cell, just to see if it helps, when I changed it to Text, Formula was not working. By default it was set to General only.
Is this error common?
I have tested VLOOKUP function with various formats in the Table, so Long as your Lookup value is ("TSK788") in the function, it works correctly. Please try your function on a new workbook on a new sheet after pasting data on some Text Editor like Note Tab Light or Note pad and the again copying and pasting data to your new worksheet. Please see if the problem still persists.

Calculated Field in Pivot Table using Conditional Formula VBA

I have this problem that I can't solve, I'm writing an Excel Macro that build up a pivot table taking the data from a table.
When a field in the table is 0 I don't want to perform the calculation of the calculated field and display a blank cell in the pivot table.
my conditional formula is this one:
=IF((field1=0),"",(field1/field2))
Putting this formula into VBA as follows
pt.CalculatedFields.Add Name:="ptfieldname", Formula:="=IF((field1=0),"",(field1/field2))"
display an empty pivot table, when I put the same formula in excel using the "Fields, Items & Set" button in the pivot table option tab goes well...
so I think that the formula is right, but what I have to do to get it permorf well also within the VBA macro?!
thanks in advance
Welcome to SO. I am pretty new here myself, but have found it very useful lately.
Anyway, here is your answer. I found it by using the Macro Recorder to see the exact syntax it uses when creating a calculated field in the pivot table. Hopefully the method of my finding the answer helps you find more answers on your own in the future.
The problem was in the way you referenced the formula in VBA. VBA needs to have actual quotes inside of quotes, so the
=IF((field1=0),"",(field1/field2))
in
pt.CalculatedFields.Add Name:="ptfieldname", Formula:="=IF((field1=0),"",(field1/field2))"
needs to be
=If(field1=0,"""",(field1/field2))

Resources