+ Reply to Thread
Results 1 to 7 of 7

Counting pages and lines (added issue)

  1. #1
    Registered User
    Join Date
    04-20-2011
    Location
    miami
    MS-Off Ver
    Excel 2007
    Posts
    4

    Counting pages and lines (added issue)

    Hey, I've been having some difficulty getting this done so i figured id ask for help.

    Im trying to create a formula where all i need to do is input the starting page and line number then the ending page and line number and get a total line count.

    For example

    starting page number:line number - ending page number:line number. Each page has 25 lines, and the first line has to be counted.

    5:9 - 5:22 = 14 lines

    A more complicated one would be

    10:15 - 12:1 = 37 lines. (11 lines in page 10, 25 lines in page 11, and 1 line in page 12).

    Any ideas or thoughts would be great. Thanks.
    Last edited by adventuresofgabe; 04-20-2011 at 10:29 AM.

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Counting pages and lines

    Assuming that you set up your nominclature just as you described in A1 and A2 and that those cells are formatted as text (otherwise you'll get some registering as time).

    =LEFT(A2,FIND(":",A2)-1)*25-LEFT(A1,FIND(":",A1)-1)*25+MID(A2,FIND(":",A2)+1,2)-MID(A1,FIND(":",A1)+1,2)+1

    Does that work for you?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    04-20-2011
    Location
    miami
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Counting pages and lines

    Thanks for the help, but the formula is giving me an error.

    Now im trying to see if i can figure it out doing it this way - starting page number in A1, line number B1, then ending page number in C1, ending line number in D1. Think thatll work better?

  4. #4
    Registered User
    Join Date
    04-20-2011
    Location
    miami
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Counting pages and lines

    Ok, i partially figured it out.

    Taking it a step further.

    Is there anyway to get it done if the entire page range is in one cell?
    Im converting a PDF to excel and it takes the entire column as is, so id have to manually split up thousands of start and end pages.

    It converts it to one cell and it looks like this - 5:9 - 5:22 in A1, A2 is 9:7 - 9:21, A3 is 10:15 - 12:1, and so on all the way down.
    Last edited by adventuresofgabe; 04-20-2011 at 10:29 AM.

  5. #5
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Counting pages and lines (added issue)

    Can you upload an example of those cells? Spacing will be crutial in separating them. Attaches is the spreadsheet for my first example.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    04-20-2011
    Location
    miami
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Counting pages and lines (added issue)

    Here is how it looks when transferred over.
    Attached Files Attached Files

  7. #7
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Counting pages and lines (added issue)

    Okay, this could be done in a single cell with a very long formula but easier to use some intermediate columns and work it that way. i.e. separate your first and last rows first into columns B and C, then do the calculation.

    In B1
    =TRIM(LEFT(A1,FIND("–",A1)-2))

    In C1
    =TRIM(MID(A1,FIND("–",A1)+2,5)) Note: 5 should be the maximum length unless you plan on going over 100 pages, then replace with a 6

    In D1
    =LEFT(C1,FIND(":",C1)-1)*25-LEFT(B1,FIND(":",B1)-1)*25+MID(C1,FIND(":",C1)+1,2)-MID(B1,FIND(":",B1)+1,2)+1

    See attachment.
    Does that work for you?
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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