SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Member
    Join Date
    Mar 2003
    Location
    dublin
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    VBScript function

    hi,
    I need the VBScript equivalent of the Math.ceil(x) function??
    Any ideas
    cheers

  2. #2
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Round(x + 0.5, 0) ?

  3. #3
    SitePoint Member
    Join Date
    Mar 2003
    Location
    dublin
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks, that worked

  4. #4
    SitePoint Member
    Join Date
    Mar 2003
    Location
    dublin
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hang on, is kinda workin but the is my code
    num_pages = Round((noofrec/Number_of_Records_Per_Page) + 0.5,0)
    where Number_of_Records_Per_Page = 5
    it works for everything except when noofrec 's is also 5
    which gives 1.5, which is round up to 2, but i dont what to some the next link if there are 5 records when im displaying 5 per page!

  5. #5
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, how about this ugly formula?

    num_pages = noofrec \ Number_of_Records_Per_Page + Abs(noofrec Mod Number_of_Records_Per_Page <> 0)


  6. #6
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Isn't this easier?
    Function Ceil(x)
    Ceil = -Int(-x)
    End Function
    MarcusJT
    - former ASP web developer / former SPF "ASP Guru"
    - *very* old blog with some useful ASP code

    - Please think, Google, and search these forums before posting!

  7. #7
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm... yes

  8. #8
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    MarcusJT
    - former ASP web developer / former SPF "ASP Guru"
    - *very* old blog with some useful ASP code

    - Please think, Google, and search these forums before posting!

  9. #9
    Non-Member
    Join Date
    May 2003
    Location
    Mtl.
    Posts
    107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lol


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
  •