Excel/Count if


Count if
Count if  
Hi Gulshan
I have a sheet where I need to enetr the data on daily basis with Alphabet "J" (Job) "R" (RONG) and "B" (Base). I am looking the formula, how will count that how many time R enter after J. I have attached the snap shot. Will you please have alook and guide me which formula I will use.
I have to count R in Q2 and J in R2 so in the attached snap shot it shows 0 but the result should be 2 in Q2 and 1 in R2 because R start twice after J and J start only 1 time after R.


Count if
Count if  
Hi Zafar,

The formula you have entered will not give the required results, what you entered will concatenate both ranges and look at the whole as a comparison value, then try to sum it.

What you need is to compare a pair of cells at a time and see if they are in order "RJ" or "JR". The best way to manage this is by adding an extra row which does the concatenation and then count on that row.
In your example, we would insert one more row (pl see row 2 in the attached image). This row will concatenate the cell above and the cell to left of above cell and compare check it for "RJ" or "JR".
Please see the third row in the attached file for the formulae used.

If this solution doesn't work for you, then we might have to look at macros to do the job.

Hope this helps.
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts




I can answer questions related to the following topics: 1. MS Excel - Creating and Linking Formulae, Running Pivot Tables, Vlookup etc. 2. Macros / VBA - Creating Macros to do specific jobs. Importing / Exporting / Validating Data in excel through Macros.


I've been working on excel for over 10 years and on VBA macros for over 3 years now.

Bachelor of Commerce, Chartered Accountant from The Institute of Chartered Accountants of India

©2016 About.com. All rights reserved.