+ Reply to Thread
Results 1 to 10 of 10

Count how many objects are between two objects with serial numbers

  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 Contributor
    Join Date
    01-09-2016
    Location
    Perth Western Australia
    MS-Off Ver
    Office 365
    Posts
    257

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

    Hi

    Try using =count(A:A), This will count the number of objects or if you wanted a part of the list then =count(A2:A45) or similar

    Cheers
    Last edited by FoxSeaLady; 04-22-2016 at 10:34 AM. Reason: Afterthought to add info

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

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

    Thank you a lot on fast response.
    That is not exactly what i need.
    I want to enter one number in 1st cell and other number in 2nd cell, and 3rd cell should calculate how many numbers are from 1st to 2nd entered number.
    Hope this explains better.
    Also sorry for my english.
    Thanks!

  4. #4
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

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

    Attach a sample spreadsheet with expected results, remove any sensitive data.
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

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

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

    Example is in attached file.

    Thanks!
    Attached Files Attached Files

  6. #6
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,847

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

    But I am wondering is there some function to do this because I need it to be more simple.
    I am not aware of a built in function, other than =e4-d4+1. Why is that simple formula not simple enough, or what about that formula does not work for you?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

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

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

    I attached another example. I need to have sum of multiple "counted numbers". In simple formula when I have all fields filled it's working correct, but it's problem when I have empty fields, like in example attached. Maybe I will solve it with IF function to check for empty field. What do you think about it?
    Attached Files Attached Files

  8. #8
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,847

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

    First some algebra:

    Formula as given: y=(a12-a11+1)+(a22-a21+1)+(a32-a31+1)+...+(an2-an1+1)
    Removing parentheses and rearranging, keeping careful track of signs, you should be able to show that this is equivalent to:
    y=a12+a22+a32+...+an2-(a11+a21+a31+...+an1)+n

    So, we simply need to sum up all of the "seconds", subtract the sum of the "firsts", then add in the number of pairs. The first two sums can be simple =SUMIF() functions, and the final step is a simple =COUNT() function.

    =SUMIF(H3:S3,"second",H4:S4)-sumif(H3:S3,"first",H4:S4)+COUNT(H4:S4)/2

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

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

    Thanks a lot!

  10. #10
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,298

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

    Try

    =SUMPRODUCT(((I4:S4+1)*(MOD(COLUMN(I1:S1),2)=1))-(H4:R4)*(MOD(COLUMN(H1:R1),2)=0))

+ 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 how many objects are between two objects with serial numbers
    By noctornus in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-22-2016, 12:21 PM
  2. Count occurances without knowing the objects
    By erison in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-11-2015, 05:26 PM
  3. 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
  4. [SOLVED] Count selected Objects
    By Mike in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-30-2012, 06:32 AM
  5. Count objects
    By crisg73 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-23-2011, 06:24 PM
  6. 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
  7. return most frequent objects/numbers in large worksheet?
    By trav in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01: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