Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Try this UDF (as I can't think of a formula solution!):
Place in required cell: =countxx(C2:N999,"Textvalue1","Textvalue2") Put code in general module ==Alt + F11 to open Visual Basic Editor == right click on VBA project (for your w/book) and Insert==module Copy/paste code below HTH ------------------------------------------------------------------------------- Function countxx(ByRef rng As Range, ByVal fval1 As String, ByVal fval2 As String) As Long n = 0 For r = 1 To rng.Rows.Count n1 = Application.Match(fval1, Range(rng(r, 1), rng(r, rng.Columns.Count)), 0) n2 = Application.Match(fval2, Range(rng(r, 1), rng(r, rng.Columns.Count)), 0) If Not IsError(n1) Then If Not IsError(n2) Then n = n + 1 End If End If Next r countxx = n End Function "5dolla" wrote: Hi, I have been trying to figure this out with no luck. I am trying to count the number of occurences that "textvalue1" appears on the same row with "textvalue2". Both "textvalue1" and "textvalue2" appear in random areas of a cell range (c2:n999). Essentially I would like to do something like this: =COUNTIF(c2:n999,"textvalue1")AND IF =COUNTIF(c2:n999,"textvalue2") and then display the number of occurences that both textvalue1 and textvalue2 appear in the same row together? Is this possible with a cell range like this or should I just stop. Thanks. -- 5dolla ------------------------------------------------------------------------ 5dolla's Profile: http://www.excelforum.com/member.php...o&userid=36493 View this thread: http://www.excelforum.com/showthread...hreadid=562529 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Forget SUMIF, COUNTIF and VLOOKUP | Excel Worksheet Functions | |||
How do I set up a countif, or sumif that is multiconditional? | Excel Worksheet Functions | |||
problems with sumif and countif | Excel Discussion (Misc queries) | |||
Reference Cells with Sumif or Countif | New Users to Excel | |||
Countif, Sumif, If - help! | Excel Worksheet Functions |