EXcel use of BDP and BDH function - excel

I want to retrive data from a past date about VOLUME_AVG_30D. Can I? I just could use the BDP to retrive this data and then this just give me the last update about this information.

Yes you can, that's what the excel adding does. Just go to the formula builder on the ribbon in the excel add-in. If you need history, use bdh.
Formula: =BDH(security, field(s), start date, end date)
Sample: =BDH($B$6,$C$7:$C$7,"12/23/2016","","Dir=V","Dts=S","Sort=A","Quote=C","QtTyp=Y","Days=T","Per=cd","DtFmt=D","UseDPDF=Y","CshAdjNormal=N","CshAdjAbnormal=N","CapChg=N","cols=2;rows=102")

Related

How to predefine the required format of a cell?

I currently build a dashboard in Excel to track forex trades. One worksheet is for adding new trades to the database. Within this worksheet i have several fields that the user needs to fill in order to add the trade to the database. Now I want to avoid that the user inserts wrong data (regarding format) in the cells and therefor crashes the outputs from the database later on.
How can I define such criteria via VBA? For example the field date to have the format YYYY-MM-DD and the field Trading Volume XX,YY so the user can't (accidentally) insert X,YY etc. For dropdown fields it is easy by defining the inputs within the dropdown menue itself, but i need some solution for the manually filled cells.
I will then define a msgbox to pop up and inform the user to meet the required input formats.
Thank you very much in advance!
Some key words would help me, I can then get into deeper it and code it by myself.
Rather than using code could you not use data validation and force entry of a date, numeric value etc.?
If you define the cell format to be custom 'yyyy-mm-dd' then apply data validation with a defined date range Excel will auto format it for you even if they enter dd/mm/yyyy and alert if an invalid entry is added.
Then for a belt and braces approach run a routine at Save that will mimic what your database will do and alert if there is still invalid data see https://learn.microsoft.com/en-us/office/vba/api/excel.workbook.beforesave
I would also lock down the sheet to avoid users adding rows / columns or moving your cells around.
enter image description here

Excel VBA format

i have a sheet where i connect to SQL. how can i create vba where every time i click refresh data connection query from power query, it will convert my text to number. Once it convert, i would like to format it to percentage and some are in accounting format. Upon refresh again, the same format will stick as it is without need to click format again. Is this possible?
Yes, it is possible, by using onChange event in VBA:
https://learn.microsoft.com/en-us/office/vba/api/excel.worksheet.change

Formatting Excel Power Query Table

I created an Excel Power Query that pulls cryptocurrency data from coinmarketcap.com's API. I want to format this data, but it won't let me.
For instance, I want the price coloumn to have a $ sign in front of it, but when I hit the $ sign in Excel, it doesn't work.
How do I enable the formatting of this data?
format the cell as Accounting Number

Filter Excel Pivot Table based on previous business day

I'd like to filter an Excel Pivot Table based on the previous business day. I currently filter it dynamically for 'Yesterday', but that does not help on Mondays. Can this be done?
The only way to solve this I can see to write a macro that modifies the date filter in your pivot table. Inside the macro you can easily chech if yesterday was a weekend day to avoid them.
You can get familiar with the code you will need by starting a macro recording, changing manually the date, stopping the macro record, and then just open macro code source. Then modify it to analyze the date, and bind the result code to some button. Done.

I need to create a custom date format on a SSAS Microsoft Tabular model to dd-MMM-yyyy

I am trying to customize the date in the format of dd-MMM-yyyy in a Microsoft tabular model and It does not seem to take.
It seems to go back to general every time I change it.
Can someone help me with a solution.
I had the same requirement and found answer over the web.
You can create a Calculated Column in your date table and use the Format function.
As an example using the AdventureWorksDW database as an example, you could create a calculated column with the following formula: =Format([FullDateAlternateKey], "dd-MMM-yyyy") and use it in target pivot
Takes from Microsoft forum

Resources