+ Reply to Thread
Results 1 to 2 of 2

Count how many objects are between two objects with serial numbers

Hybrid View

  1. #1
    Registered User
    Join Date
    11-24-2011
    Location
    Banja Luka, Bosnia
    MS-Off Ver
    Excel 2013
    Posts
    17

    Count how many objects are between two objects with serial numbers

    I have objects with serial numbers, example 230, 231, 232, 233 ... Is there a function that can count how many object are from 231 to 278 for example. It can be done with subtracting 278 and 231, and adding 1. But I am wondering is there some function to do this because I need it to be more simple.
    Thanks a lot!

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Count how many objects are between two objects with serial numbers

    Hello noctornus,

    Objects have names but depending on the object may have a caption or value property. Which property are these serial numbers applied to?

    You really cannot get simpler than using addition and subtraction. You could make it more convenient by creating a function like below.

    Function ObjectCount(ByVal First_SerialNumber, ByVal Last_SerialNumber)
        ObjectCount = ABS(Last_SerialNumber - First_SerialNumber + 1)
    End Function
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ 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. Count occurances without knowing the objects
    By erison in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-11-2015, 05:26 PM
  2. How to hide a selection of objects but show objects automatically when opening wkbk
    By slowjo1414 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-05-2013, 05:24 PM
  3. [SOLVED] Count selected Objects
    By Mike in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-30-2012, 06:32 AM
  4. Count objects
    By crisg73 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-23-2011, 06:24 PM
  5. return most frequent objects/numbers in large worksheet?
    By trav in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 06:05 PM
  6. return most frequent objects/numbers in large worksheet?
    By trav in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 PM
  7. [SOLVED] return most frequent objects/numbers in large worksheet?
    By trav in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 10:05 AM

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