Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 55
Default Multiplying to string arrays

I have to arrays of test strings. Values could be Low, medium or High in both
arrays. I need to count how many pairs of High values appear when only High
has been selected for any row. In other words, when the same label has been
assigned in both column, that's a valid instance I wanna count.

here's an example:

Array1
Low
Medium
High
High

Array2
High
Medium
High
Medium

There is just one pair of Highs (3rd), and therefore the returned value
should be 1.

Thanks, Stefano
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,073
Default Multiplying to string arrays


smaruzzi wrote:
I have to arrays of test strings. Values could be Low, medium or High in both
arrays. I need to count how many pairs of High values appear when only High
has been selected for any row. In other words, when the same label has been
assigned in both column, that's a valid instance I wanna count.

here's an example:

Array1
Low
Medium
High
High

Array2
High
Medium
High
Medium

There is just one pair of Highs (3rd), and therefore the returned value
should be 1.

Thanks, Stefano


Hi Stefano,

If your arrays are on a worksheet, say Array1 is A1:A4 and Array2 is
B1:B4, then use...

==SUMPRODUCT((A1:A4="High")*(B1:B4="High"))

If your arrays are VB arrays then use...

Dim lTally As Long
Dim I As Long
For I = 1 To UBound(Array1)
If Array1(I) = "High" And Array2(I) = "High" Then
Let lTally = lTally + 1
End If
Next
MsgBox lTally

I have assumed your arrays are one dimensional.

Ken Johnson

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,718
Default Multiplying to string arrays

=COUNT(IF((A2:A5="High")*(B2:B5="High"),1))

Array formula you have to commit CtrlShiftEnter (not just enter)



"smaruzzi" wrote:

I have to arrays of test strings. Values could be Low, medium or High in both
arrays. I need to count how many pairs of High values appear when only High
has been selected for any row. In other words, when the same label has been
assigned in both column, that's a valid instance I wanna count.

here's an example:

Array1
Low
Medium
High
High

Array2
High
Medium
High
Medium

There is just one pair of Highs (3rd), and therefore the returned value
should be 1.

Thanks, Stefano

Reply
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
LINKEDRANGE function - a complement to the PULL function (for getting values from a closed workbook) [email protected] Excel Worksheet Functions 0 September 5th 06 03:44 PM
macro unouwanme Excel Discussion (Misc queries) 9 August 31st 06 09:38 PM
Need help setting the worksheet header/Footer margins based on string height? Doug Excel Discussion (Misc queries) 0 August 20th 06 02:05 AM
List File Properties - Author SS Excel Worksheet Functions 1 June 23rd 06 04:56 PM
Auto convert an alphanumeric string (CIS9638S) to numbers only? Gary L Brown Excel Worksheet Functions 1 September 7th 05 01:17 AM


All times are GMT +1. The time now is 09:33 PM.

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"