If then Countif

p86c

New Member
Joined
Jun 13, 2020
Messages
16
Office Version
  1. 2010
Platform
  1. Windows
Hi everyone - hoping you might help with this - it seems like an easy thing to propose but I have spent most of the morning googling and haven't got what I am hoping to find yet.

I have a spreadsheet with a column of student names and rows of subjects into which grades are entered.

At the end of each row I have used a Countif to total the number of each type of grade that each student name has achieved. - this works fine.

I have added a column to the right of the Student Names called "Remove" and I would like to use it in such a way that if I enter a character eg an "0" into a cell beside a name that I can stop the Countif from totalling the grades of each type, but if the character in the cell is a "1" then the formula works as it did.

I haven't had any success doing this...
but I have learnt about filtering - which still adds up even hidden rows.
I also thought about multiple criteria Countifs - but the criteria seems to require a range, rather than the single cell check I want to use.
I have got tied up in SUMPRODUCT knots to be honest.

the working formula that just adds up, for example C grades is
=COUNTIF(F13:AF13,"C")

I am trying to get that formula to return a result only when C13 (my "Remove" column) has a !1" in it - otherwise it should return a zero count.

Hoping this might be something you can advise on?
p86c
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
That's it! Thankyou very much gaz_chops!

so.... just so I understand what this function means

the COUNTIF only does its job if C13 is 1 and if it isn't it returns the value 0 as shown after the comma....

is that it?
 
Upvote 0
You're welcome and yes, the if statement is saying if C13 meets the criteria then do the countif, otherwise return zero.
 
Upvote 0
A shorter version for the fun of it =(C13=1)*COUNTIF(F13:AF13,"C")
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,728
Members
448,987
Latest member
marion_davis

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