CountIF Values (Text) related to a Cell

GoranH

New Member
Joined
May 15, 2019
Messages
8
I need to count how many times an item went from a certain source, and afterwards from which source it went the most.
Say...

[TABLE="width: 500"]
<tbody>[TR]
[TD]Source[/TD]
[TD]Item[/TD]
[/TR]
[TR]
[TD]Wallmart [/TD]
[TD]Apple[/TD]
[/TR]
[TR]
[TD]Wallmart [/TD]
[TD]Apple[/TD]
[/TR]
[TR]
[TD]Newegg[/TD]
[TD]Apple[/TD]
[/TR]
[TR]
[TD]Target[/TD]
[TD]Apple[/TD]
[/TR]
[TR]
[TD]Wallmart [/TD]
[TD]Apple[/TD]
[/TR]
[TR]
[TD]Target[/TD]
[TD]Apple[/TD]
[/TR]
[TR]
[TD]Wallmart [/TD]
[TD]Apple[/TD]
[/TR]
</tbody>[/TABLE]


How do I, on a new sheet add next to the cell with value "Apple", columns Wallmart/Target/Newegg, and how many times they appeared related to the value "Apple", or oranges etc.

And/or, just return the "Source" that appeared the most related to the value Apple.
If needed I can provide an actual file with example.

Regards
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Hey,

I'd make a column for each source, say A1 = wallmart, B1 = Newegg, C1 = Target, I'd put an item column in D which lists the unique items (apple/orange) etc

Then use a SUMPRODUCT formula as such:

A2:
Code:
SUMPRODUCT((A$1='YourTabName'!$A$2:$A$8)*('YourTabName'!$B$2:$B$8=$D2))

Where A2:A8 and B2:B8 contain the data listed in the example above on the sheet 'YourTabName' - change as appropriate (as you're using a second sheet to write the formula)
 
Upvote 0
Hey,

I'd make a column for each source, say A1 = wallmart, B1 = Newegg, C1 = Target, I'd put an item column in D which lists the unique items (apple/orange) etc

Then use a SUMPRODUCT formula as such:

A2:
Code:
SUMPRODUCT((A$1='YourTabName'!$A$2:$A$8)*('YourTabName'!$B$2:$B$8=$D2))

Where A2:A8 and B2:B8 contain the data listed in the example above on the sheet 'YourTabName' - change as appropriate (as you're using a second sheet to write the formula)

Works ok enough if I then add another column that returns header with max values like so
"=INDEX($A$1:$C$1,0,MATCH(MAX($A2:$C2),$A2:$C2,0)) .... where A1:C1 are headers, and A2:C2 are returned values.

Aight works, though if anyone could make something that works in a single cell, it'd be great.

Thanks tyija
 
Upvote 0

Forum statistics

Threads
1,223,711
Messages
6,174,020
Members
452,542
Latest member
Bricklin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top