count .5V as 0.5, not 1 or 0
MZ Tools makes life easier for the Excel VBA coder
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: count .5V as 0.5, not 1 or 0

  1. #1
    Guest

    Default

     
    I work on an attendance spreadsheet where the cells values are V, S, .5V and .5S. I can get the formula to count each V as 1, but it won't recognize .5V as 0.5 and count it as .5

    Can anyone help me?

  2. #2
    MrExcel MVP Aladin Akyurek's Avatar
    Join Date
    Feb 2002
    Location
    The Hague, NL
    Posts
    81,775
    Post Thanks / Like
    Mentioned
    11 Post(s)
    Tagged
    1 Thread(s)

    Default

    On 2002-02-28 20:50, Anonymous wrote:
    I work on an attendance spreadsheet where the cells values are V, S, .5V and .5S. I can get the formula to count each V as 1, but it won't recognize .5V as 0.5 and count it as .5

    Can anyone help me?
    Consider the following sample

    {".5V";
    "V";
    "S";
    ".5V";
    "V";
    ".5S";
    "V"}

    in A1:A7.

    In B1 enter: V [ the item of interest ]

    In C1 array-enter:

    =COUNTIF(A1:A7,B1)+SUM((IF(ISNUMBER(SUBSTITUTE(A1:A7,B1,"")+0),SUBSTITUTE(A1:A7,B1,"")+0)))

    This will "sum" B1-values that occur in the range of interest.

    To array-enter a formula, you need to hit control+shift+enter at the same time, not just enter.

  3. #3
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Austin, Texas USA
    Posts
    11,654
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Use...

    =COUNTIF(A:A,".5V")/2+COUNTIF(A:A,"V")

    ...where column A contains your attendance values.

    Or, use the array formula...

    {=SUM((A1:A4={"V",".5V"})*{1,0.5})}

    ...where your values are in the cell range A1:A4.

    Note: Array formulas must be entered using the Control+Shift+Enter key combination. The outermost braces, {}, are not entered by you -- they're supplied by Excel in recognition of a properly entered array formula.


    [ This Message was edited by: Mark W. on 2002-03-01 09:06 ]

  4. #4
    Guest

    Default

    Thank you Mark! The COUNTIF formula worked, whereas the array formula gave me a #VALUE! error. And yes, I did press CTRL-SHIFT-ENTER.

  5. #5
    MrExcel MVP Aladin Akyurek's Avatar
    Join Date
    Feb 2002
    Location
    The Hague, NL
    Posts
    81,775
    Post Thanks / Like
    Mentioned
    11 Post(s)
    Tagged
    1 Thread(s)

    Default

      
    On 2002-03-01 18:16, Anonymous wrote:
    Thank you Mark! The COUNTIF formula worked, whereas the array formula gave me a #VALUE! error. And yes, I did press CTRL-SHIFT-ENTER.
    [img]/board/images/smiles/icon_biggrin.gif[/img]
    That the array-formulas return a #VALUE! rror seems to indicate that you have formula-returned blanks in the range of interest.

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com