Need help with Countif and placing the result in adjacent cell

senthia87

New Member
Joined
Sep 25, 2013
Messages
14
I need to find the countifs of two seperate variables and put that result in the adjacent cells. Basically, trying to find a way to pin point where the last two variables reside in the two seperate countif ranges. Data will be added in anytime
ex. rows (7-11) and columns Y and AA
[TABLE="width: 100"]
<TBODY>[TR]
[TD]Y
[/TD]
[TD]AA
[/TD]
[/TR]
[TR]
[TD]DEF
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]ABC
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]ABC
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]ABC
[/TD]
[TD]=countif(Y:Y,"ABC")
[/TD]
[/TR]
[TR]
[TD]DEF
[/TD]
[TD]=countif(Y:Y,"DEF")
[/TD]
[/TR]
</TBODY>[/TABLE]

Then if the ABC countif is greater than "V38", I want to populate the cell next to them with a P. For countif DEF I want to do the same except use cell "V39".
ex. Let's say V38= 3 V39= 2
[TABLE="width: 100"]
<TBODY>[TR]
[TD]Y
[/TD]
[TD]AA
[/TD]
[TD]AB
[/TD]
[/TR]
[TR]
[TD]DEF
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]ABC
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]ABC
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]ABC
[/TD]
[TD]=countif(Y:Y,"ABC")
[/TD]
[TD]=if(AA10>V38,"P"," ")
[/TD]
[/TR]
[TR]
[TD]DEF
[/TD]
[TD]=countif(Y:Y,"DEF")
[/TD]
[TD]=if(AA11>V39,"P"," ")
[/TD]
[/TR]
</TBODY>[/TABLE]
So if there was another ABC after the last DEF than I would need the macro to recognize that and put the P in the adjacent cell to that instead if greater than "V38"

Is there a way to do this?

What i started to mess around with:
Dim countif as an integer
countif= (Y:Y,"ABC")
when countif > "V38" then
activecell.value = "P"
 
Last edited:

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
For the formulas in column AA:


Excel 2010
YZAA
1DEF 
2ABC
3ABC
4ABC3
5DEF2
Sheet1
Cell Formulas
RangeFormula
AA1=IF(COUNTIF(Y$1:Y1,Y1)=COUNTIF(Y:Y,Y1),COUNTIF(Y$1:Y1,Y1),"")


For the formulas in column AB what determines V38 or V39?
 
Upvote 0
Are the last two inputs guaranteed different, or not necessarily? If not, do you still want the 2 COUNTIF formulas to be applied to the same input? Or there are only 2 types of input in Column Y and you want a count for each of them to be placed at the bottom 2 rows in Column AA?
 
Upvote 0
They are not guaranteed to be different. In column Y there might be more than two inputs. If there is, then I want the countif for each put in AA where the last variable for each countif is.
ex.

[TABLE="width: 100"]
<TBODY>[TR]
[TD]Y[/TD]
[TD]Z[/TD]
[TD]AA[/TD]
[/TR]
[TR]
[TD]DEF [/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]ABC[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]ABC[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]ABC[/TD]
[TD][/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]DEF[/TD]
[TD][/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]GHI[/TD]
[TD][/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]ABC[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</TBODY>[/TABLE]
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,876
Members
452,363
Latest member
merico17

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