+ Reply to Thread
Results 1 to 6 of 6

IF statement to highlight values crossing round and half round numbers

  1. #1
    Forum Contributor
    Join Date
    08-20-2009
    Location
    Plymouth, England
    MS-Off Ver
    Excel 2013
    Posts
    149

    IF statement to highlight values crossing round and half round numbers

    Hi all,

    I am currently looking to automate a backtest for the foreign exchange market.

    All currency pairs trade to four decimal points. I would like Excel to tell me when a value crosses a round number eg. 1.2800 and half round number eg. 1.2850.

    I'm assuming the easiest way to do this would be by using an IF statement, but I have limited experience with formulas in Excel.

    I have attached an example spreadsheet.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    11-26-2014
    Location
    Bosnia&Herzegovina
    MS-Off Ver
    Office2013
    Posts
    281

    Re: IF statement to highlight values crossing round and half round numbers

    I hope this will help.

    Conditional format cells B2:C5 where formula is true:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    11-26-2014
    Location
    Bosnia&Herzegovina
    MS-Off Ver
    Office2013
    Posts
    281

    Re: IF statement to highlight values crossing round and half round numbers

    Oops, semicolon is for my "middle east" country, please, replace with colon(

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,830

    Re: IF statement to highlight values crossing round and half round numbers

    No!!! Replace with commas!

    =IF(LEN(B2)<=5,OR(MID(B2,5,1)="5",MID(B2,5,1)="0",LEN(B2)<=4))
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  5. #5
    Forum Contributor
    Join Date
    11-26-2014
    Location
    Bosnia&Herzegovina
    MS-Off Ver
    Office2013
    Posts
    281

    Re: IF statement to highlight values crossing round and half round numbers

    Oops, lost in translation! THANKS AGAIN DEAR ALI

  6. #6
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: IF statement to highlight values crossing round and half round numbers

    If by round you mean the 3rd and 4th digits to the right of the decimal point are 0, then the test whether you've crossed a round number would be INT(100*open)<>INT(100*close), and the test whether you've crosses a half round number would be INT(200*open)<>INT(200*close). Something like
    Formula: copy to clipboard
    Please Login or Register  to view this content.

+ 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] Round up a time value to nearest half hour
    By annica123 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-03-2019, 12:26 PM
  2. Replies: 5
    Last Post: 01-30-2015, 11:34 AM
  3. [SOLVED] Round to Nearest Half Based On Defined Range of Decimal
    By HobbesIsReal in forum Excel General
    Replies: 2
    Last Post: 08-03-2013, 03:52 PM
  4. round UP numbers in half increment.
    By dannyboy213 in forum Excel General
    Replies: 1
    Last Post: 08-30-2006, 04:26 PM
  5. how do I round hours worked to the next half hour with a 24hr shif
    By gycoso3 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-28-2006, 04:30 PM
  6. Round up to next half number
    By rmb4253 in forum Excel - New Users/Basics
    Replies: 7
    Last Post: 03-23-2006, 05:55 AM
  7. Round to nearest quarter & half
    By hailnorm in forum Excel General
    Replies: 1
    Last Post: 04-14-2005, 01:47 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