+ Reply to Thread
Results 1 to 10 of 10

Is there easy way to identify cells with foreign currency?

  1. #1
    Forum Contributor VAer's Avatar
    Join Date
    09-10-2016
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    782

    Is there easy way to identify cells with foreign currency?

    I have thousands of symbol, and use VBA to write formula STOCKHISTORY for each symbol. Majority returns with US currency, except a few (e.g. AGI), not sure why.

    https://finance.yahoo.com/quote/AGI/

    It supposes to pull data for this company, but excel STOCKHISTORY does not work properly with all symbols. But it is okay, not a lot of them.

    I would like to identify those symbols with non US currency(then remove them from my spreadsheet), how should I tell if a cell is not US currency? It is too annoying to review manually, and I could miss catching some symbols.
    Attached Images Attached Images

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2407
    Posts
    26,095

    Re: Is there easy way to identify cells with foreign currency?

    The currency is based on the exchange that the data is pulled from. You can force it to pull in USD by specifying the exchange, but you would have to know the exchange for each stock. For example this specifies the NYSE:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    (no need for "-0" as in your formula)

    Exchange codes listed here: https://support.microsoft.com/en-us/...a-c5a6c8e787e6

    I am unable to find a way to determine the currency type or cell format returned by STOCKHISTORY.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor VAer's Avatar
    Join Date
    09-10-2016
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    782

    Re: Is there easy way to identify cells with foreign currency?

    Quote Originally Posted by 6StringJazzer View Post
    The currency is based on the exchange that the data is pulled from. You can force it to pull in USD by specifying the exchange, but you would have to know the exchange for each stock. For example this specifies the NYSE:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    (no need for "-0" as in your formula)

    Exchange codes listed here: https://support.microsoft.com/en-us/...a-c5a6c8e787e6

    I am unable to find a way to determine the currency type or cell format returned by STOCKHISTORY.
    But there are some other US exchanges.

    NYSE Arca ARCX
    OTC Markets OTCM
    Nasdaq Stock Market XNAS
    New York Stock Exchange XNYS
    NASDAQ Stockholm XSTO

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2407
    Posts
    26,095

    Re: Is there easy way to identify cells with foreign currency?

    Yes, there are other exchanges that quote trades in USD. I only gave a single example to show the Excel syntax.

    If you do not specify the exchange, you get whatever Microsoft defaults to and I know of no way to determine what that is, or to determine the currency returned. Somebody else might.

  5. #5
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,425

    Re: Is there easy way to identify cells with foreign currency?

    Please Login or Register  to view this content.
    Artik

  6. #6
    Forum Contributor VAer's Avatar
    Join Date
    09-10-2016
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    782

    Re: Is there easy way to identify cells with foreign currency?

    Quote Originally Posted by Artik View Post
    Please Login or Register  to view this content.
    Artik
    I don't think it works, because it is formulas in the cell, I don't think VBA code can check the formula. Unless I copy the whole sheet and paste as value, but I don't want to do so, I want to keep the formulas.

    But thank you anyway, it does not matter to include some non US currency symbols. I don't need to track all the symbols. It is not something important for me to fix (make it perfect)
    Last edited by VAer; 11-03-2024 at 08:58 PM.

  7. #7
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,425

    Re: Is there easy way to identify cells with foreign currency?

    I get the impression that you have not tried this code when the cell with formula is active.

    Artik

  8. #8
    Forum Contributor VAer's Avatar
    Join Date
    09-10-2016
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    782

    Re: Is there easy way to identify cells with foreign currency?

    Quote Originally Posted by Artik View Post
    I get the impression that you have not tried this code when the cell with formula is active.

    Artik
    Days ago, I manually reviewed the sheet and removed some symbols (non US currency). My current symbol list comes up with US dollar.

    But I really appreciate your code, I will save the code, in case I need it in the future.

  9. #9
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2407
    Posts
    26,095

    Re: Is there easy way to identify cells with foreign currency?

    Quote Originally Posted by VAer View Post
    I don't think it works
    It works. I have tested it. This code checks what is actually displayed in the cell. You should test code before telling us it doesn't work.

  10. #10
    Forum Contributor VAer's Avatar
    Join Date
    09-10-2016
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    782

    Re: Is there easy way to identify cells with foreign currency?

    @Artik

    Last time I manually reviewed and removed non US currency symbols.

    With symbol list updated periodically, there are new symbols with non US currency. I use your code to detect symbol with non US currency symbols, it does work.

    One question: what does 2 mean in Left(ActiveCell.Text, 2) ? Do I need only one character from the left?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Excel formula to translate foreign currency
    By sunboy in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-18-2022, 09:39 AM
  2. Help- Investment tracker with foreign currency
    By jonathon81 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-12-2020, 12:43 AM
  3. [SOLVED] Identify cells that contain foreign (Chinese, Japanese) characters?
    By MetroBOS in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-27-2015, 06:20 PM
  4. Looking for help on a foreign currency spreadsheet. A bit complex
    By pizzainacup in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-04-2014, 08:33 PM
  5. Format Textbox as foreign currency
    By cschoyer in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-30-2013, 01:35 PM
  6. Replies: 1
    Last Post: 03-07-2006, 12:20 PM
  7. [SOLVED] foreign currency loan calculations
    By Bjarnim in forum Excel General
    Replies: 0
    Last Post: 01-23-2005, 11:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1