+ Reply to Thread
Results 1 to 11 of 11

Shortening a formula.

  1. #1
    Registered User
    Join Date
    04-19-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    38

    Shortening a formula.

    Hello, I would like to know if there is a way to shorten this formula. All I am doing is adding up specific cells that contain the number 1 and getting a total count.

    =SUM(COUNTIF(C3,"1"),COUNTIF(N3,"1"),COUNTIF(Y3,"1"),COUNTIF(AJ3,"1"),COUNTIF(AU3,"1"),COUNTIF(BF3,"1"),COUNTIF(BQ3,"1"),COUNTIF(CB3,"1"),COUNTIF(CM3,"1"),COUNTIF(CX3,"1"),COUNTIF(DI3,"1"),COUNTIF(DT3,"1"),COUNTIF(EE3,"1"),COUNTIF(EP3,"1"),COUNTIF(FA3,"1"),COUNTIF(FL3,"1"),COUNTIF(FW3,"1"),COUNTIF(GH3,"1"),COUNTIF(GS3,"1"),COUNTIF(HD3,"1"),COUNTIF(HO3,"1"),COUNTIF(HZ3,"1"),COUNTIF(IK3,"1"),COUNTIF(IV3,"1"),COUNTIF(JG3,"1"),COUNTIF(JR3,"1"),COUNTIF(KC3,"1"),COUNTIF(KN3,"1"),COUNTIF(KY3,"1"),COUNTIF(LJ3,"1"),COUNTIF(LU3,"1"))

    Thanks!

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Shortening a formula.

    hi cle. maybe:
    =SUMPRODUCT((MOD(COLUMN(C3:LU3),11)=3)*(C3:LU3="1"))

    does your current formula give you the right answer? by putting the double quotes for 1, you are actually looking for a text

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Registered User
    Join Date
    04-19-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Shortening a formula.

    Yes, my current formula does give the right answer, I was wondering if there is just a way to shorten it. I can't use a range of cells C3:LU3 because there will be some 1's in other cells that I do not want to count. I am looking for the text "1" as I want to total up how many times it shows up in certain cells.
    for instances
    Jan1 Jan2 etc...
    late sick late sick
    1 1 1

    for all the late's, I want to count how many times a 1 shows up for the month. So I am selecting all of the cells under late and doing the countif.

    Hope that makes sense.

  4. #4
    Valued Forum Contributor
    Join Date
    12-25-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2016
    Posts
    506

    Re: Shortening a formula.

    EDIT: Please ignore this solution as I didn't noticed that it was text; refer benishiryo's working solution.

    Hi, will this work for you?
    Formula: copy to clipboard
    Please Login or Register  to view this content.




    _______________________________________________________________________________________________________________________________
    1. Click on the * Add Reputation if you think someone helped you
    2. Mark your thread as SOLVED when question is resolved

    Alvin
    Last edited by alvin-chung; 01-23-2014 at 10:56 AM.

  5. #5
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,449

    Re: Shortening a formula.

    Is the rule of list of columns that: next column number is greater than previous one by 11?
    If so, try:
    Please Login or Register  to view this content.
    Quang PT

  6. #6
    Registered User
    Join Date
    04-19-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Shortening a formula.

    I don't think I am explaining myself very well, I have attached a file as an example.

    I am trying to calculate all the Late's that have a number 1.

    So with my current formula I am doing a countif and selecting A3, C3, E3, G3, I3 to get the sum.

    If I do a range, A3:J3, will it not pick up the 1's that are in the Sick's as well?
    Attached Files Attached Files

  7. #7
    Valued Forum Contributor
    Join Date
    12-25-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2016
    Posts
    506

    Re: Shortening a formula.

    Hi cle12000, benishiryo's solution in post#2 is handling that (with MOD function that take cares of your every 11th columns starting from column 3).
    Had you tried the formula? Or you had tried but not getting same result as your original formula?



    _______________________________________________________________________________________________________________________________
    1. Click on the * Add Reputation if you think someone helped you
    2. Mark your thread as SOLVED when question is resolved

    Alvin

  8. #8
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,449

    Re: Shortening a formula.

    Is it simple like this:
    =SUMIF(A2:J2,"late",A3:J3)

  9. #9
    Registered User
    Join Date
    04-19-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Shortening a formula.

    Yeah, it's not giving me the right answer for some reason. I'll just leave it the way it is with the long formula, thanks for helping.

  10. #10
    Valued Forum Contributor
    Join Date
    12-25-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2016
    Posts
    506

    Re: Shortening a formula.

    I saw different criteria in post#1 vs post#6
    You're welcome, and come back anytime if you have questions



    _______________________________________________________________________________________________________________________________
    1. Click on the * Add Reputation if you think someone helped you
    2. Mark your thread as SOLVED when question is resolved

    Alvin

  11. #11
    Registered User
    Join Date
    04-19-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Shortening a formula.

    I do have to give props turned out it worked. Thanks a lot for your help everyone.

+ 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. Please help shortening this formula!!
    By chivalry2 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-10-2013, 08:08 AM
  2. Shortening of a Big Formula
    By nanocrazy in forum Excel General
    Replies: 3
    Last Post: 03-30-2009, 12:59 AM
  3. [SOLVED] Shortening a formula
    By GTVT06 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-19-2006, 09:50 PM
  4. [SOLVED] Shortening a formula
    By GTVT06 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-19-2006, 06:25 PM
  5. [SOLVED] Shortening a formula
    By GTVT06 in forum Excel General
    Replies: 0
    Last Post: 07-19-2006, 12:45 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