+ Reply to Thread
Results 1 to 11 of 11

is there a better way to do If i2 = 25 Or i2 = 50 Or i2 = 75 Or i2 = 100

  1. #1
    Registered User
    Join Date
    10-11-2003
    Posts
    81

    is there a better way to do If i2 = 25 Or i2 = 50 Or i2 = 75 Or i2 = 100

    Yep its 4 am im dead tired.. and im creating this in an if statement.

    If i2 = 25 Or i2 = 50 Or i2 = 75 Or i2 = 100 Or i2 = 125 Or i2 = 150 Or i2 = 175 Or i2 = 200 Or i2 = inifinity

    I know im not thinking... is there like If i2 = multiples of 25 then.. im over thi.... zzzz zzzz zzzzz zzzzz zzzzz zzzzz night! lol lemme know thanks.
    Last edited by AliGW; 10-17-2020 at 01:22 PM.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,523

    Re: DONT LAUGH.. but is there a better way to do If i2 = 25 Or i2 = 50 Or i2 = 75 Or i2 =

    What is supposed to happen in the formula?

  3. #3
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: DONT LAUGH.. but is there a better way to do If i2 = 25 Or i2 = 50 Or i2 = 75 Or i2 =

    Good dreams, ...
    =IF(AND(MOD(I2,25)=0,I2<>0),"do this","do that")

  4. #4
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,605

    Re: DONT LAUGH.. but is there a better way to do If i2 = 25 Or i2 = 50 Or i2 = 75 Or i2 =

    Quote Originally Posted by 0o0o0 View Post
    Yep its 4 am im dead tired.. and im creating this in an if statement.

    If i2 = 25 Or i2 = 50 Or i2 = 75 Or i2 = 100 Or i2 = 125 Or i2 = 150 Or i2 = 175 Or i2 = 200 Or i2 = inifinity
    I2 = infinity ? Which Infinity ? Aleph-nought Aleph -One.... ?

  5. #5
    Registered User
    Join Date
    10-11-2003
    Posts
    81

    Re: DONT LAUGH.. but is there a better way to do If i2 = 25 Or i2 = 50 Or i2 = 75 Or i2 =

    omg sorry guys!! I posted in excel formulas, and meant it for VBA.. doh!

    Do I have the capability of deleting this entire thread sorry!!


    Basically For i2 = 1 To 300

    when i2 reaches 25 50 75 100 125 150 175 200 225 250 275 300

    it does an if statement of... a quick clear cache task..

    I just wanted to know if theres a more condensed way for this.. than putting If i2 = 25 Or i2 = 50 Or i2 = 75 Or i2 = 100 Or i2 = 125 Or i2 = 150 Or i2 = 175 Or i2 = 200

    Your magical wizardry converted to my language lol....... If i2=(every multiple of 25) ..go do something...

    but I put this in excel formulas not vba.. so sorry.
    Last edited by 0o0o0; 10-17-2020 at 01:23 PM.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,403

    Re: is there a better way to do If i2 = 25 Or i2 = 50 Or i2 = 75 Or i2 = 100

    This thread has been moved to the VBA section.
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  7. #7
    Registered User
    Join Date
    10-11-2003
    Posts
    81

    Re: is there a better way to do If i2 = 25 Or i2 = 50 Or i2 = 75 Or i2 = 100

    thanks. Sorry

  8. #8
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,936

    Re: is there a better way to do If i2 = 25 Or i2 = 50 Or i2 = 75 Or i2 = 100

    If myvar Mod 25 = 0 Then
    End If
    Ben Van Johnson

  9. #9
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,463

    Re: is there a better way to do If i2 = 25 Or i2 = 50 Or i2 = 75 Or i2 = 100

    Try it like this...
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    10-11-2003
    Posts
    81

    Re: is there a better way to do If i2 = 25 Or i2 = 50 Or i2 = 75 Or i2 = 100

    Nice, will try, thanks I was just reading up on "case"... think ya saved me a day of offtrack reading lol

    WORKS AWESOME THANKS.. even simpler code than I expected. Thank you.
    Last edited by 0o0o0; 10-17-2020 at 02:17 PM.

  11. #11
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,463

    Re: is there a better way to do If i2 = 25 Or i2 = 50 Or i2 = 75 Or i2 = 100

    By the way, here is an alternate method you could use...
    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] TEXT Function Failing in Excel 2016 365 - ONLY READ IF YOU WANT A LAUGH!!!
    By AliGW in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-10-2017, 08:37 AM
  2. EXCEL COMPARING with EACH OTHER IN SAME RANGE
    By mistrymah in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-15-2014, 04:42 AM
  3. This made me laugh
    By Kyle123 in forum The Water Cooler
    Replies: 2
    Last Post: 01-06-2014, 07:50 PM
  4. Replies: 3
    Last Post: 07-10-2013, 06:06 PM
  5. This made me laugh
    By Kyle123 in forum The Water Cooler
    Replies: 3
    Last Post: 04-11-2013, 04:31 AM
  6. Replies: 1
    Last Post: 12-14-2009, 05:20 PM
  7. [SOLVED] So easy you will probably laugh
    By Jennifer in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-20-2005, 04:05 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