LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,339
Default sumif countif thing?

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Forget SUMIF, COUNTIF and VLOOKUP Pierre Leclerc Excel Worksheet Functions 16 April 27th 23 11:51 AM
How do I set up a countif, or sumif that is multiconditional? Mr. Yanni Excel Worksheet Functions 9 June 21st 06 09:17 AM
problems with sumif and countif Simon Shaw Excel Discussion (Misc queries) 6 July 23rd 05 10:02 PM
Reference Cells with Sumif or Countif GK New Users to Excel 1 May 3rd 05 06:21 PM
Countif, Sumif, If - help! Angel160 Excel Worksheet Functions 2 November 3rd 04 05:23 PM


All times are GMT +1. The time now is 07:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"