Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Sam via OfficeKB.com
 
Posts: n/a
Default Sum Count of Two Numbers in the same Row

Hi All,

Dynamic Named Range "Results" spans 5 Columns and many Rows. Each cell
houses numeric single-digit or double-digit values.

I would like a Formula to find / match all instances of any two particular
numbers (single-digit / double-digit) in the same Row and Sum the Count of
their total occurrences together. For instance, how many times, if any, does
80 and 87 appear together in the same Row. I would like to refer to the
values using two cell references.

Thanks
Sam


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...tions/200509/1
  #3   Report Post  
Domenic
 
Posts: n/a
Default

Assuming that A1 contains your first criterion, such as 80, and B1
contains your second criterion, such as 87, try...

=SUM(--(MMULT(--(Results=A1),TRANSPOSE(COLUMN(Results)^0))*MMULT(--(Resul
ts=B1),TRANSPOSE(COLUMN(Results)^0))0))

....confirmed with CONTROL+SHIFT+ENTER.

Hope this helps!

In article ,
"Sam via OfficeKB.com" wrote:

Hi All,

Dynamic Named Range "Results" spans 5 Columns and many Rows. Each cell
houses numeric single-digit or double-digit values.

I would like a Formula to find / match all instances of any two particular
numbers (single-digit / double-digit) in the same Row and Sum the Count of
their total occurrences together. For instance, how many times, if any, does
80 and 87 appear together in the same Row. I would like to refer to the
values using two cell references.

Thanks
Sam

  #4   Report Post  
Sam via OfficeKB.com
 
Posts: n/a
Default

Hi Don,

Don Guillett wrote:
shouldn't a simple =COUNTIF( do it for you?


I don't get the expected results using a simple =COUNTIF. Could you,
possibly provide an example based on:

Dynamic Named Range "Results" spans 5 Columns and many Rows. Each cell
houses numeric single-digit or double-digit values.

I would like a Formula to find / match all instances of any two particular
numbers (single-digit / double-digit) in the same Row and Sum the Count of
their total occurrences together. For instance, how many times, if any, does
80 and 87 appear together in the same Row. I would like to refer to the
values using two cell references.

Much appreciated.
Cheers,
Sam

Don Guillett wrote:
shouldn't a simple =COUNTIF( do it for you?

Hi All,

[quoted text clipped - 9 lines]
Thanks
Sam



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...tions/200509/1
  #5   Report Post  
Domenic
 
Posts: n/a
Default

Do the two numbers always occur consecutively in the row?

Do the two numbers only appear together once in the row?

If so, try the following instead...

Assumptions:

D1:H10 contains your 5 columns of data

A1 contains your first criterion, such as 80

B1 contains your second criterion, such as 87

Formula:

=SUM(MMULT((D1:G10=A1)*(E1:H10=B1),TRANSPOSE(COLUM N(D1:G10)^0)))

....confirmed with CONTROL+SHIFT+ENTER.

Hope this helps!

In article ,
"Sam via OfficeKB.com" wrote:

Hi All,

Dynamic Named Range "Results" spans 5 Columns and many Rows. Each cell
houses numeric single-digit or double-digit values.

I would like a Formula to find / match all instances of any two particular
numbers (single-digit / double-digit) in the same Row and Sum the Count of
their total occurrences together. For instance, how many times, if any, does
80 and 87 appear together in the same Row. I would like to refer to the
values using two cell references.

Thanks
Sam



  #6   Report Post  
Sam via OfficeKB.com
 
Posts: n/a
Default

Hi Domenic,

Thank you very much for assistance and a brilliant Formula. The Formula is
returning the expected results.

Is it possible to tweak the Formula based on my matrix type layout below.
The results are being returned to a chart / matrix layout: I have the
criterion vertically and horizontally and then they are referenced using the
horizontal and vertical cell address that houses the criterion, and the
result is returned to the intercept of the vertical and horizontal criterion.
So at some point both criterion values being referenced will be the same, if
possible can the Formula return a zero when this occurs?

Example:
Cell Ref. A2 and B1 criterion 80 and 80
Cell Ref. A3 and C1 criterion 81and 81


Criteria B1 houses 80, C1 houses 81, D1 houses 82, E1
houses 83, etc
A2 houses 80 0 4
9 7
A3 houses 81 5 0
3 2
A4 houses 82 7 3
0 1
A5 houses 83 2 7
5 0


So, I would use your Formula with the corresponding vertical and horizontal
cell references (and copy across and down):
=SUM(--(MMULT(--(Results=$A2),TRANSPOSE(COLUMN(Results)^0))*MMULT(--
(Results=B$1),TRANSPOSE(COLUMN(Results)^0))0))
....confirmed with CONTROL+SHIFT+ENTER.

Cheers,
Sam

Domenic wrote:
Assuming that A1 contains your first criterion, such as 80, and B1
contains your second criterion, such as 87, try...

=SUM(--(MMULT(--(Results=A1),TRANSPOSE(COLUMN(Results)^0))*MMULT(--(Resul
ts=B1),TRANSPOSE(COLUMN(Results)^0))0))

...confirmed with CONTROL+SHIFT+ENTER.

Hope this helps!

Hi All,

[quoted text clipped - 9 lines]
Thanks
Sam



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...tions/200509/1
  #7   Report Post  
Sam via OfficeKB.com
 
Posts: n/a
Default

Hi Domenic,

Just replied to your earlier Post. Thanks for further input.

Domenic wrote:
Do the two numbers always occur consecutively in the row?

No

Do the two numbers only appear together once in the row?

Yes

If so, try the following instead...

Assumptions:

D1:H10 contains your 5 columns of data

A1 contains your first criterion, such as 80

B1 contains your second criterion, such as 87

Formula:

=SUM(MMULT((D1:G10=A1)*(E1:H10=B1),TRANSPOSE(COLU MN(D1:G10)^0)))

...confirmed with CONTROL+SHIFT+ENTER.

Hope this helps!


Cheers
Sam


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...tions/200509/1
  #8   Report Post  
Domenic
 
Posts: n/a
Default

Try...

=IF($A2<B$1,SUM(--(MMULT(--(Results=$A2),TRANSPOSE(COLUMN(Results)^0))*M
MULT(--(Results=B$1),TRANSPOSE(COLUMN(Results)^0))0)),0)

....confirmed with CONTROL+SHIFT+ENTER.

Hope this helps!

In article ,
"Sam via OfficeKB.com" wrote:

Hi Domenic,

Thank you very much for assistance and a brilliant Formula. The Formula is
returning the expected results.

Is it possible to tweak the Formula based on my matrix type layout below.
The results are being returned to a chart / matrix layout: I have the
criterion vertically and horizontally and then they are referenced using the
horizontal and vertical cell address that houses the criterion, and the
result is returned to the intercept of the vertical and horizontal criterion.
So at some point both criterion values being referenced will be the same, if
possible can the Formula return a zero when this occurs?

Example:
Cell Ref. A2 and B1 criterion 80 and 80
Cell Ref. A3 and C1 criterion 81and 81


Criteria B1 houses 80, C1 houses 81, D1 houses 82, E1
houses 83, etc
A2 houses 80 0 4
9 7
A3 houses 81 5 0
3 2
A4 houses 82 7 3
0 1
A5 houses 83 2 7
5 0


So, I would use your Formula with the corresponding vertical and horizontal
cell references (and copy across and down):
=SUM(--(MMULT(--(Results=$A2),TRANSPOSE(COLUMN(Results)^0))*MMULT(--
(Results=B$1),TRANSPOSE(COLUMN(Results)^0))0))
...confirmed with CONTROL+SHIFT+ENTER.

Cheers,
Sam

Domenic wrote:
Assuming that A1 contains your first criterion, such as 80, and B1
contains your second criterion, such as 87, try...

=SUM(--(MMULT(--(Results=A1),TRANSPOSE(COLUMN(Results)^0))*MMULT(--(Resul
ts=B1),TRANSPOSE(COLUMN(Results)^0))0))

...confirmed with CONTROL+SHIFT+ENTER.

Hope this helps!

Hi All,

[quoted text clipped - 9 lines]
Thanks
Sam

  #9   Report Post  
Sam via OfficeKB.com
 
Posts: n/a
Default

Hi Domenic,

Great! Thank you so much.

Domenic wrote:
Try...

=IF($A2<B$1,SUM(--(MMULT(--(Results=$A2),TRANSPOSE(COLUMN(Results)^0))*M
MULT(--(Results=B$1),TRANSPOSE(COLUMN(Results)^0))0)),0)

...confirmed with CONTROL+SHIFT+ENTER.


Cheers,
Sam

Domenic wrote:
Try...

=IF($A2<B$1,SUM(--(MMULT(--(Results=$A2),TRANSPOSE(COLUMN(Results)^0))*M
MULT(--(Results=B$1),TRANSPOSE(COLUMN(Results)^0))0)),0)

...confirmed with CONTROL+SHIFT+ENTER.

Hope this helps!

Hi Domenic,

[quoted text clipped - 48 lines]
Thanks
Sam



--
Message posted via http://www.officekb.com
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
Match Last Occurrence of two numbers and Return Date Sam via OfficeKB.com Excel Worksheet Functions 6 April 5th 05 12:40 PM
Match Last Occurrence of two numbers and Count to Previous Occurence Sam via OfficeKB.com Excel Worksheet Functions 33 April 4th 05 02:17 PM
Count and Sum Total occurrances of two specific numbers Sam via OfficeKB.com Excel Worksheet Functions 10 March 29th 05 08:13 PM
Sorting when some numbers have a text suffix confused on the tundra Excel Discussion (Misc queries) 5 December 18th 04 10:19 PM
How do I create formula to count numbers in a range of cells? EmilyJ Excel Worksheet Functions 1 December 8th 04 05:24 AM


All times are GMT +1. The time now is 05:42 PM.

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

About Us

"It's about Microsoft Excel"