none
or function

    질문

  • I have a worksheet that tracks the reliability of my hard disks

    =COUNTIF(assets!$F$1:$F$99999,OR("operational","retired"))

    This does not get me the count. Now if I dump the OR and use the function with the string it works, just I wanted to count for the 2 cases


    Windows MVP 2011-12, XP, Vista, 7. Expanding into Windows Server 2008 R2, SQL Server, SharePoint, Cloud, Virtualization etc. etc.

    Hardcore Games, Legendary is the only Way to Play

    Developer | Windows IT | Chess | Economics | Vegan Advocate | PC Reviews

    2012년 6월 9일 토요일 오후 12:15

답변

  • On Sat, 9 Jun 2012 12:15:15 +0000, Vegan Fanatic [MVP] wrote:
     
    >
    >
    >I have a worksheet that tracks the reliability of my hard disks
    >
    >=COUNTIF(assets!$F$1:$F$99999,OR("operational","retired"))
    >
    >This does not get me the count. Now if I dump the OR and use the function with the string it works, just I wanted to count for the 2 cases
    >
    >
    >
     
    OR will only return a single result.   It seems you are looking for an array of results.  It can be done using:
     
    =SUM(COUNTIF(assets!$F$1:$F$99999,{"operational","retired"}))
     
     

    Ron
    • 답변으로 표시됨 Vegan FanaticMVP 2012년 6월 9일 토요일 오후 10:43
    2012년 6월 9일 토요일 오후 10:34

모든 응답

  • OR is a an excel function which accepts either Logical Value or Numeric.It does not accept String/text. 

    Following will do the job.

    =COUNTIF(assets!$F$1:$F$99999,"operational")+COUNTIF(assets!$F$1:$F$99999,"retired")

    2012년 6월 9일 토요일 오후 1:21
  • that is what I ended up doing, I was simply wondering if the OR could be embedded as speculated


    Windows MVP 2011-12, XP, Vista, 7. Expanding into Windows Server 2008 R2, SQL Server, SharePoint, Cloud, Virtualization etc. etc.

    Hardcore Games, Legendary is the only Way to Play

    Developer | Windows IT | Chess | Economics | Vegan Advocate | PC Reviews

    2012년 6월 9일 토요일 오후 1:30
  • On Sat, 9 Jun 2012 12:15:15 +0000, Vegan Fanatic [MVP] wrote:
     
    >
    >
    >I have a worksheet that tracks the reliability of my hard disks
    >
    >=COUNTIF(assets!$F$1:$F$99999,OR("operational","retired"))
    >
    >This does not get me the count. Now if I dump the OR and use the function with the string it works, just I wanted to count for the 2 cases
    >
    >
    >
     
    OR will only return a single result.   It seems you are looking for an array of results.  It can be done using:
     
    =SUM(COUNTIF(assets!$F$1:$F$99999,{"operational","retired"}))
     
     

    Ron
    • 답변으로 표시됨 Vegan FanaticMVP 2012년 6월 9일 토요일 오후 10:43
    2012년 6월 9일 토요일 오후 10:34