Praveen --
If you must use VBA, you can adapt some variation of the following procedure ... Sub Reliance_Buy() Dim r&, LastRow&, Cnt& With Sheet1 LastRow& = 9 For r& = 1 To LastRow& If .Cells(r&, 1).Value = "Reliance" And _ .Cells(r&, 2).Value = "Buy" Then _ Cnt& = Cnt& + 1 Next r& End With MsgBox Cnt& End Sub ----- Unless you have a compelling reason to use VBA, I would suggest an array formula Here's an example ... =SUM((A1:A9="Reliance")*(B1:B9="Buy")) Important - when you enter this formula, use ... {Ctrl} + {Shift} + {Enter} - Rodney POWELL Microsoft MVP - Excel www.BeyondTechnology.com On Mar 27, 9:13 pm, Praveen Khunte <praveen.khu...@gmail.com> wrote: > Hello Everyone > This is my first query. I am consolidating my stocks balance sheet for > the fiscal year 2008-09. > I am having 2 columns. > A B > Reliance Sell > ABB Buy > RNRL Sell > Reliance Buy > ABB Sell > RNRL Buy > Reliance Buy > ABB Sell > RNRL Sell > and the list continues > I wanted to count the number of times Reliance is sold, also number of > times Reliance is bought. Similarly for other scrips, i want to count. > Can any one help with the formula or macros. I am a novice to Macros. > > Praveen Khunte --~--~---------~--~----~------------~-------~--~----~ ------------------------------------------------------------------------------------- Some important links for excel users: 1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at http://www.excelitems.com 2. Excel tutorials at http://www.excel-macros.blogspot.com 3. Learn VBA Macros at http://www.vbamacros.blogspot.com 4. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com If you find any spam message in the group, please send an email to: Ayush Jain @ jainayus...@gmail.com or Ashish Jain @ 26may.1...@gmail.com ------------------------------------------------------------------------------------- -~----------~----~----~----~------~----~------~--~---