+ Reply to Thread
Results 1 to 3 of 3

Want to make formula shorter and more efficient by hopefully using a loop funtion.

  1. #1
    Registered User
    Join Date
    08-12-2014
    Location
    Edmonton, Alberta
    MS-Off Ver
    2010
    Posts
    2

    Post Want to make formula shorter and more efficient by hopefully using a loop funtion.

    What I'm trying to do is add strings with multiple values, for example;

    in one cell, user enters 1F, then in another cell they enter 0.4F, I want 1.4F when I sum them up. Basically I'm counting special hours of work for each month (normal hours don't have the "F" which I have no problems with).

    I'm also calling upon other worksheets, so below is a small chunk of the code I'm using. The problem with this method is that I need to manually input the value for each string.

    (COUNTIF(JAN!B2:JAN!AF2,"1F") + COUNTIF(FEB!B2:FEB!AC2,"1F") + COUNTIF(MAR!B2:MAR!AF2,"1F") + COUNTIF(APR!B2:APR!AE2,"1F") + COUNTIF(MAY!B2:MAY!AF2,"1F") + COUNTIF(JUN!B2:JUN!AE2,"1F") + COUNTIF(JUL!B2:JUL!AF2,"1F") + COUNTIF(AUG!B2:AUG!AF2,"1F") + COUNTIF(SEP!B2:SEP!AE2,"1F") + COUNTIF(OCT!B2:OCT!AF2,"1F") + COUNTIF(NOV!B2:NOV!AE2,"1F") + COUNTIF(DEC!B2:DEC!AF2,"1F")) + ((COUNTIF(JAN!B2:JAN!AF2,"1/2F") + COUNTIF(FEB!B2:FEB!AC2,"1/2F") + COUNTIF(MAR!B2:MAR!AF2,"1/2F") + COUNTIF(APR!B2:APR!AE2,"1/2F") + COUNTIF(MAY!B2:MAY!AF2,"1/2F") + COUNTIF(JUN!B2:JUN!AE2,"1/2F") + COUNTIF(JUL!B2:JUL!AF2,"1/2F") + COUNTIF(AUG!B2:AUG!AF2,"1/2F") + COUNTIF(SEP!B2:SEP!AE2,"1/2F") + COUNTIF(OCT!B2:OCT!AF2,"1/2F") + COUNTIF(NOV!B2:NOV!AE2,"1/2F") + COUNTIF(DEC!B2:DEC!AF2,"1/2F"))*(1/2)) + ((COUNTIF(JAN!B2:JAN!AF2,"1/4F") + COUNTIF(FEB!B2:FEB!AC2,"1/4F") + COUNTIF(MAR!B2:MAR!AF2,"1/4F") + COUNTIF(APR!B2:APR!AE2,"1/4F") + COUNTIF(MAY!B2:MAY!AF2,"1/4F") + COUNTIF(JUN!B2:JUN!AE2,"1/4F") + COUNTIF(JUL!B2:JUL!AF2,"1/4F") + COUNTIF(AUG!B2:AUG!AF2,"1/4F") + COUNTIF(SEP!B2:SEP!AE2,"1/4F") + COUNTIF(OCT!B2:OCT!AF2,"1/4F") + COUNTIF(NOV!B2:NOV!AE2,"1/4F") + COUNTIF(DEC!B2:DEC!AF2,"1/4F"))*(1/4))

    This continues on for multiple fractions. Basically I'm counting each instance of the fraction, then multiplying it to get the value that each string should give me.

    Btw: I don't actually like the fractions so I may just use integers instead, but the problem with that is I need to change multiple numbers as you can see.

    A For loop or IF statement would be greatly appreciated, sorry if I made this difficult to understand.

  2. #2
    Forum Expert boopathiraja's Avatar
    Join Date
    07-12-2013
    Location
    Coimbatore,TamilNadu, India
    MS-Off Ver
    Excel 2007, 2013, 2016, 365
    Posts
    1,455

    Re: Want to make formula shorter and more efficient by hopefully using a loop funtion.

    Hi,

    Please post a sample in excel file
    Click just below left if it helps, Boo?ath?

  3. #3
    Registered User
    Join Date
    08-12-2014
    Location
    Edmonton, Alberta
    MS-Off Ver
    2010
    Posts
    2

    Re: Want to make formula shorter and more efficient by hopefully using a loop funtion.

    I'm sorry, I'm not sure what this means.

    Is that a different forum? I'll go check.

+ 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. Make a formula shorter
    By PatrikIden in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-03-2014, 01:45 PM
  2. [SOLVED] How can I make this code shorter by using a loop. or there's any easier shorcuts code
    By romarkevinruiz in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-10-2014, 08:53 AM
  3. Alternative Formula for multiples IFs (to make my formula shorter)
    By chico.corrales in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-07-2013, 12:37 AM
  4. [SOLVED] How to make formula shorter ?
    By nur2544 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-19-2012, 02:14 PM
  5. How to make my formula more efficient
    By yuzi in forum Excel General
    Replies: 7
    Last Post: 05-29-2009, 05:54 PM

Tags for this Thread

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