Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
Hi All,
I have a table of numbers that spans nine Columns (A-I)and 400+ Rows (20- 480). I have made the table a Dynamic Range called "Numbers". Each Row contains numbers in ascending order. Is there a formula that can check for two specific numbers Row by Row through the (nine column) Range "Numbers" and give a final Count of how many times the two numbers appear together in each Row of the Dynamic Range "Numbers"? Columns A-I Rows 20-480 Example sample data from Range "Numbers" ROW20 51 58 59 65 69 72 73 76 79 ROW31 50 51 58 72 73 76 79 80 81 ROW50 50 52 60 62 68 69 70 75 76 ROW75 53 54 59 60 62 69 70 72 73 ROW80 50 51 58 59 70 71 72 73 76 ROW83 51 53 65 67 68 69 78 80 81 ROW94 51 52 58 60 61 65 67 72 73 ROW99 50 53 57 62 63 68 70 71 73 Example Criteria: Count how many times 72 AND 73 appear together in the same Row throughout the Dynamic Range "Numbers". Expected Result from sample Range "Numbers": COUNT=5 72 AND 73 appear together a total of 5 times - Rows 20, 31, 75, 80 and 94. Regards, Sam -- Message posted via http://www.officekb.com |
#2
![]() |
|||
|
|||
![]()
Sam,
If the 73 is always in the same row in the column after the 72, then =SUMPRODUCT((Numbers=72)*(OFFSET(Numbers,0,1)=73)) If the numbers could appear randomly throughout the row, then another solution whould be required. HTH, Bernie MS Excel MVP "Sam via OfficeKB.com" wrote in message ... Hi All, I have a table of numbers that spans nine Columns (A-I)and 400+ Rows (20- 480). I have made the table a Dynamic Range called "Numbers". Each Row contains numbers in ascending order. Is there a formula that can check for two specific numbers Row by Row through the (nine column) Range "Numbers" and give a final Count of how many times the two numbers appear together in each Row of the Dynamic Range "Numbers"? Columns A-I Rows 20-480 Example sample data from Range "Numbers" ROW20 51 58 59 65 69 72 73 76 79 ROW31 50 51 58 72 73 76 79 80 81 ROW50 50 52 60 62 68 69 70 75 76 ROW75 53 54 59 60 62 69 70 72 73 ROW80 50 51 58 59 70 71 72 73 76 ROW83 51 53 65 67 68 69 78 80 81 ROW94 51 52 58 60 61 65 67 72 73 ROW99 50 53 57 62 63 68 70 71 73 Example Criteria: Count how many times 72 AND 73 appear together in the same Row throughout the Dynamic Range "Numbers". Expected Result from sample Range "Numbers": COUNT=5 72 AND 73 appear together a total of 5 times - Rows 20, 31, 75, 80 and 94. Regards, Sam -- Message posted via http://www.officekb.com |
#3
![]() |
|||
|
|||
![]() "Bernie Deitrick" <deitbe @ consumer dot org wrote in message ... Sam, If the 73 is always in the same row in the column after the 72, then =SUMPRODUCT((Numbers=72)*(OFFSET(Numbers,0,1)=73)) If the numbers could appear randomly throughout the row, then another solution whould be required. Here is such a solution =SUMPRODUCT(--((COUNTIF(INDIRECT("B"&ROW(numbers)&":G"&ROW(numbe rs)),72)0)* (COUNTIF(INDIRECT("B"&ROW(numbers)&":G"&ROW(number s)),73)0))) |
#4
![]() |
|||
|
|||
![]()
Correction, to align with your columns
=SUMPRODUCT(--((COUNTIF(INDIRECT("A"&ROW(numbers)&":I"&ROW(numbe rs)),72)0)* (COUNTIF(INDIRECT("A"&ROW(numbers)&":I"&ROW(number s)),73)0))) -- HTH RP (remove nothere from the email address if mailing direct) "Bob Phillips" wrote in message ... "Bernie Deitrick" <deitbe @ consumer dot org wrote in message ... Sam, If the 73 is always in the same row in the column after the 72, then =SUMPRODUCT((Numbers=72)*(OFFSET(Numbers,0,1)=73)) If the numbers could appear randomly throughout the row, then another solution whould be required. Here is such a solution =SUMPRODUCT(--((COUNTIF(INDIRECT("B"&ROW(numbers)&":G"&ROW(numbe rs)),72)0)* (COUNTIF(INDIRECT("B"&ROW(numbers)&":G"&ROW(number s)),73)0))) |
#5
![]() |
|||
|
|||
![]()
Hi Bob,
Thank you for your time and assistance. I've tried your formula but get a count of zero, I know there should definitely be a count of more than zero. =SUMPRODUCT(--((COUNTIF(INDIRECT("A"&ROW(numbers)&":I"&ROW(numbe rs)),72)0) *(COUNTIF(INDIRECT("A"&ROW(numbers)&":I"&ROW(numbe rs)),73)0))) Further help appreciated. Regards, Sam -- Message posted via http://www.officekb.com |
#6
![]() |
|||
|
|||
![]()
Hi Bob,
Please ignore my previous reply to you. All is clear now. Missed your link to Bernie's Post - "If the numbers could appear randomly throughout the row, then another solution whould be required". Here is such a solution =SUMPRODUCT(--((COUNTIF(INDIRECT("B"&ROW(numbers)&":G"&ROW(numbe rs)),72)0) *(COUNTIF(INDIRECT("B"&ROW(numbers)&":G"&ROW(numbe rs)),73)0))) Thanks Sam -- Message posted via http://www.officekb.com |
#7
![]() |
|||
|
|||
![]()
Hi Bob,
Correction, to align with your columns =SUMPRODUCT(--((COUNTIF(INDIRECT("A"&ROW(numbers)&":I"&ROW(numbe rs)),72)0)* (COUNTIF(INDIRECT("A"&ROW(numbers)&":I"&ROW(number s)),73)0))) Also these array formulas (not dependent on any location) : =SUM(--(0<MMULT(--(Numbers=72),TRANSPOSE(COLUMN(Numbers)*0+1)) *MMULT(--(Numbers=73),TRANSPOSE(COLUMN(Numbers)*0+1)))) or =COUNT(IF(MMULT(--(Numbers=72),TRANSPOSE(COLUMN(Numbers)^0)), 1/MMULT(--(Numbers=73),TRANSPOSE(COLUMN(Numbers)^0)))) Regards, Daniel M. |
#8
![]() |
|||
|
|||
![]()
Hi Daniel,
"Daniel.M" wrote in message ... Also these array formulas (not dependent on any location) : =SUM(--(0<MMULT(--(Numbers=72),TRANSPOSE(COLUMN(Numbers)*0+1)) *MMULT(--(Numbers=73),TRANSPOSE(COLUMN(Numbers)*0+1)))) MMULT is not an oft used function by me, a bit like SIGN was until Frank pointed out some uses to me. Must keep it in mind. or =COUNT(IF(MMULT(--(Numbers=72),TRANSPOSE(COLUMN(Numbers)^0)), 1/MMULT(--(Numbers=73),TRANSPOSE(COLUMN(Numbers)^0)))) It's always nice to see a solution by a real formula man :-) Regards Bob |
#9
![]() |
|||
|
|||
![]()
Hi Bernie,
Thank you for your time and assistance. Your formula provides the required result. =SUMPRODUCT((Numbers=72)*(OFFSET(Numbers,0,1)=73)) Thanks again, Sam -- Message posted via http://www.officekb.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|