Good idea. Your suggestion gave me this idea: Lock the entire column that contains the child count and when a value is entered into the key column on a new row (the license number), use a macro to insert the formula into the locked column.
I guess I was hoping there was a way to assign a formula to the whole column that would use wild cards or some identifier for "current row" as such: =COUNTIFS(ChildCells!A$2:A$65536,A<currentRow>,ChildCells!D$2:D $65536,"" ) The idea being that whenever a new row was added, the formula would automatically apply and use the license number in the identifier column. On Jul 24, 1:16 pm, Paul Schreiner <schreiner_p...@att.net> wrote: > I think a fairly 'simple' way to do it is using a worksheet_change event. > When the sheet is changed, have the event check to see if the column > changed is a specific column that always has data. > then, the macro could unprotect the sheet, insert the formula, then > re-protect the sheet. > > sound feasible? > > Paul > > ________________________________ > From: Dinsdale <russ.ha...@gmail.com> > To: MS EXCEL AND VBA MACROS <excel-macros@googlegroups.com> > Sent: Friday, July 24, 2009 12:30:59 PM > Subject: $$Excel-Macros$$ Counting Cells in a Parent/Child relationship > > I would like to apologize if this has been answered in another thread, > but I could not find it in the searches I was doing. Maybe I was > searching the wrong thing... > > I am a software developer trying to create a temporary solution to a > problem using Excel 2007. One of our divisions needs to track a parent/ > child relationship and get a count of the child items per parent. > > The first spreadsheet has the parent items that includes a License > Number, Name, <other info>, a cancellation date and a count of the > child elements. > > The second spreadsheet contains the child elements in no particular > order. The child records contain the parent license number, name, > <other info>, and a cancellation date. > > We are looking at having the count field in the parent record count > the child items by license number, where the (child) cancellation date > is blank. We can achieve this using the COUNTIFS() function as such: > > =COUNTIFS(ChildCells!A$2:A$65536,A2,ChildCells!D$2:D$65536,"" ) > > Where cells A2:A65536 are the parent license numbers and cells > D2:D65536 are the child cancellation dates. > > The main issue I see with this is that the users must copy and paste > the formula into the "count cell" every time a new row is added and, > quite frankly, I don't trust them to do it correctly. > > Does anyone know of a more "eligant" or "user proof" method to do > this? I am not against writing VBA macros, but I'm not sure where to > start. > > Any help on this subject would be greatly appreciated. > > Sincerely, > > Dinsdale --~--~---------~--~----~------------~-------~--~----~ ---------------------------------------------------------------------------------- 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 <><><><><><><><><><><><><><><><><><><><><><> HELP US GROW !! We reach over 5,200 subscribers worldwide and receive many nice notes about the learning and support from the group. Our goal is to have 10,000 subscribers by the end of 2009. Let friends and co-workers know they can subscribe to group at http://groups.google.com/group/excel-macros/subscribe -~----------~----~----~----~------~----~------~--~---