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
Y
AA
DEF
ABC
ABC
ABC
=countif(Y:Y,"ABC")
DEF
=countif(Y:Y,"DEF")

<TBODY>
</TBODY>

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
Y
AA
AB
DEF
ABC
ABC
ABC
=countif(Y:Y,"ABC")
=if(AA10>V38,"P"," ")
DEF
=countif(Y:Y,"DEF")
=if(AA11>V39,"P"," ")

<TBODY>
</TBODY>
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

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
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.

YZAA
DEF
ABC
ABC
ABC3
DEF2
GHI1
ABC

<TBODY>
</TBODY>
 
Upvote 0

Forum statistics

Threads
1,214,946
Messages
6,122,401
Members
449,081
Latest member
JAMES KECULAH

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