Home

Counting words in one column based on dates in another column.

%3CLINGO-SUB%20id%3D%22lingo-sub-123725%22%20slang%3D%22en-US%22%3ECounting%20words%20in%20one%20column%20based%20on%20dates%20in%20another%20column.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-123725%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Everyone%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20looking%20for%20help%20coming%20up%20with%20a%20formula%20to%20do%20the%20following...%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20the%20A%20column%20I%20have%20a%20clients%20status%20which%20is%20either%20%22Completed%22%2C%20%22AMA%22%2C%20or%20%22Admin'%3C%2FP%3E%3CP%3EIn%20the%20B%20column%20I%20have%20a%20discharge%20date%20which%20ranges%20from%20Jan%202015%20to%20November%202017%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%20I'm%20looking%20to%20do%20is%20count%20the%20occurrences%20of%20of%20the%20clients%20status%20by%20month%20over%20the%20past%203%20years.%26nbsp%3BFor%20example%20I%20want%20to%20see%20the%20count%20of%20how%20many%20clients%20were%20Completed%2C%20AMA%2C%20or%20Admin%20between%20January%201st%202015%20and%20January%2031st%202015%20and%20then%20so%20on%20month%20by%20month%20until%20October%202017%20broken%20down%20by%20month.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20tried%20to%20look%20around%20to%20find%20a%20formula%20that%20would%20consider%20the%20date%20in%20Column%20B%20and%20then%20look%20at%20the%20status%20word%20in%20column%20A%20to%20count%20but%20have%20had%20not%20luck.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20help%20with%20this%20is%20much%20appreciated.%3C%2FP%3E%3CP%3EThank%20You%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-123725%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EFormulas%20%26amp%3B%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ENeed%20Help%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-390882%22%20slang%3D%22en-US%22%3ERe%3A%20Counting%20words%20in%20one%20column%20based%20on%20dates%20in%20another%20column.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-390882%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F310571%22%20target%3D%22_blank%22%3E%40kellymuzy%3C%2FA%3E%26nbsp%3B%2C%20glad%20it%20helped%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-390859%22%20slang%3D%22en-US%22%3ERe%3A%20Counting%20words%20in%20one%20column%20based%20on%20dates%20in%20another%20column.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-390859%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20stumbled%20upon%20this%20discussion%20when%20trying%20to%20solve%20a%20similar%20issue%20and%20pivot%20tables%20completely%20changed%20everything%20for%20me.%20I%20had%20a%20little%20bit%20of%20time%20to%20understand%20the%20basics%20and%20I%20can't%20believe%20I%20hadn't%20been%20using%20them%20all%20along.%20Thank%20you%20for%20your%20input%20on%20this%20question!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-124305%22%20slang%3D%22en-US%22%3ERe%3A%20Counting%20words%20in%20one%20column%20based%20on%20dates%20in%20another%20column.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-124305%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Matt%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20perhaps%20easier%20and%20more%20reliable%20will%20be%20if%20you%20define%20start%20and%20end%20dates%20of%20you%20periods%20in%20the%20sheet%20cells%20(you%20may%20use%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3DEDATE(%26lt%3Bdate%26gt%3B%2C3)%3C%2FPRE%3E%3CP%3Enot%20to%20enter%20all%20dates%20manually)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eand%20for%20such%20data%20structure%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20818px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F23562i752B072A5ED25EEA%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Counting.JPG%22%20title%3D%22Counting.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3Ethe%20formula%20in%20F3%20will%20be%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3DCOUNTIFS(%24A%242%3A%24A%24600%2C%22%26gt%3B%3D%22%26amp%3B%24D3%2C%24A%242%3A%24A%24600%2C%22%26lt%3B%3D%22%26amp%3B%24E3%2C%24B%242%3A%24B%24600%2CF%242)%3C%2FPRE%3E%3CP%3Eyou%20may%20frag%20it%20down%20and%20when%20entire%20column%20to%20the%20right.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20alternative%20(in%20L3)%20is%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3DSUMPRODUCT((%24A%242%3A%24A%24600%26gt%3B%3D%24J3)*(%24A%242%3A%24A%24600%26lt%3B%3D%24K3)*(ISNUMBER(SEARCH(L%242%2C%24B%242%3A%24B%24600))))%3C%2FPRE%3E%3CP%3EWith%20this%20it's%20not%20necessary%20to%20correct%20the%20formula%20for%20each%20period%2Fstatus.%20However%2C%20if%20you%20range%20with%20data%20will%20be%20out%20of%20one%20defined%20in%20formula%20you%20have%20to%20correct%20the%20formulas%20again.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFrom%20that%20point%20of%20view%20(and%20not%20only)%20better%20to%20convert%20you%20range%20into%20the%20table%20-stay%20on%20any%20cell%20within%20it%20and%20press%20Ctrl%2BT.%3C%2FP%3E%3CP%3EIt%20looks%20like%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20682px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F23563iAD5CFD5B9F893687%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22CountingTable.JPG%22%20title%3D%22CountingTable.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3Eand%20above%20formulas%20could%20be%20transferred%20to%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3DCOUNTIFS(Table1%5BDate%5D%2C%22%26gt%3B%3D%22%26amp%3B%24D3%2CTable1%5BDate%5D%2C%22%26lt%3B%3D%22%26amp%3B%24E3%2CTable1%5BStatus%5D%2CF%242)%3C%2FPRE%3E%3CP%3Eand%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3DSUMPRODUCT((Table1%5BDate%5D%26gt%3B%3D%24J3)*(Table1%5BDate%5D%26lt%3B%3D%24K3)*(ISNUMBER(SEARCH(L%242%2CTable1%5BStatus%5D))))%3C%2FPRE%3E%3CP%3Esure%20instead%20of%20adding%20%22*%22%20in%20columns%20names%20you%20may%20use%3C%2FP%3E%3CPRE%3E%2C%20%22*%22%20%26amp%3B%20F%242%20%26amp%3B%20%22*%22%20%3C%2FPRE%3E%3CP%3Ein%20first%20formulas.%3C%2FP%3E%3CP%3ESample%20is%20attached%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-124161%22%20slang%3D%22en-US%22%3ERe%3A%20Counting%20words%20in%20one%20column%20based%20on%20dates%20in%20another%20column.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-124161%22%20slang%3D%22en-US%22%3E%3CP%3ESergei%20and%20Yossi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20for%20both%20of%20your%20inputs%20on%20this.%26nbsp%3B%20I%20started%20messing%20around%20with%20pivot%20tables%20and%20I%20do%20see%20that%20they%20will%20be%20easier%20to%20use%20in%20the%20future%20once%20I%20get%20more%20familiar%20with%20them.%26nbsp%3B%20In%20the%20meantime%20I%20was%20able%20to%20use%20the%20following%20formula%20to%20achieve%20my%20goal.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3DCOUNTIFS(%24A%242%3A%24A%24480%2C%22%26gt%3B%3D1%2F1%2F2016%22%2C%24A%242%3A%24A%24480%2C%22%26lt%3B%3D3%2F31%2F2016%22%2C%24B%242%3A%24B%24480%2C%22*Admin*%22)%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThen%20I%20would%20simply%20change%20dates%2C%20or%20the%20word%20to%20get%20what%20I%20was%20looking%20for%20for%20that%20particular%20part%20of%20the%20table%20I%20was%20building.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20again%20to%20you%20both.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-123863%22%20slang%3D%22en-US%22%3ERe%3A%20Counting%20words%20in%20one%20column%20based%20on%20dates%20in%20another%20column.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-123863%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Yossi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFor%20such%20kind%20of%20tasks%20formulas%20(COUNTIFS%2C%20SUMPRODUCT%2C%20whatever)%20is%20less%20flexible%20and%20more%20time%20consuming%20solution%20compare%20to%20PivotTables.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWith%20formulas%20you%20have%20to%20build%20manually%20resulting%20table%2C%20add%20formulas%20to%20it%2C%20test%20them%20to%20be%20sure%20they%20work%20correctly.%20And%20repeat%20the%20same%20if%20one%20day%20you%20add%2Fchange%20the%20status%2C%20decide%20to%20calculate%20averages%20not%20only%20counts%2C%20etc.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPivotTable%2C%20especially%20in%26nbsp%3Bcombination%20with%20Table%2C%20gives%20the%20same%20in%20couple%20of%20clicks.%20With%20adding%20new%20data%20you%20shall%20expand%20resulting%20table%20with%20formulas%20manually%2C%20with%20PivotTable%20just%20refresh%20it.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-123787%22%20slang%3D%22en-US%22%3ERe%3A%20Counting%20words%20in%20one%20column%20based%20on%20dates%20in%20another%20column.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-123787%22%20slang%3D%22en-US%22%3EHi%20Segey%20and%20Matt%3CBR%20%2F%3Ewhy%20not%20use%20countifs%3F%3CBR%20%2F%3E%3CBR%20%2F%3EYossi%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-123739%22%20slang%3D%22en-US%22%3ERe%3A%20Counting%20words%20in%20one%20column%20based%20on%20dates%20in%20another%20column.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-123739%22%20slang%3D%22en-US%22%3E%3CP%3EMatt%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFirst%20two%20links%20I%20found%20with%20PivotTable%20basics%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fsupport.office.com%2Fen-us%2Farticle%2FCreate-a-PivotTable-to-analyze-worksheet-data-A9A84538-BFE9-40A9-A8E9-F99134456576%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsupport.office.com%2Fen-us%2Farticle%2FCreate-a-PivotTable-to-analyze-worksheet-data-A9A84538-BFE9-40A9-A8E9-F99134456576%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22http%3A%2F%2Fwww.excel-easy.com%2Fdata-analysis%2Fpivot-tables.html%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Fwww.excel-easy.com%2Fdata-analysis%2Fpivot-tables.html%3C%2FA%3E%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Egoogle%20will%20give%20much%20more.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFor%20your%20case%3C%2FP%3E%3CP%3EBetter%20if%20you%20work%20with%20Excel%20Tables%2C%20if%20not%20the%20range%20works%20as%20well.%20Select%20one%20which%20is%20with%20your%20data%2C%3C%2FP%3E%3CP%3Ein%20ribbon%20Insert-%26gt%3BPivot%20Table.%26nbsp%3B%3C%2FP%3E%3CP%3EPivotTable%20pane%20will%20appear%2C%20add%20Date%20to%20rows%2C%20Status%20to%20Columns%20and%20Values.%20Result%20looks%20like%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20807px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F23432iE8BE2CAAAB552501%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22PivotTable.JPG%22%20title%3D%22PivotTable.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAfter%20that%20is%20adjusting%20-%20how%20to%20group%20dates%2C%20how%20to%20design%20the%20table.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-123727%22%20slang%3D%22en-US%22%3ERe%3A%20Counting%20words%20in%20one%20column%20based%20on%20dates%20in%20another%20column.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-123727%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Sergei%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENo%20I%20have%20not.%26nbsp%3B%20I%20am%20rather%20new%20to%20excel%20and%20am%20not%20familiar%20with%20Pivot%20Tables%20or%20how%20they%20work.%26nbsp%3B%20Can%20you%20provide%20any%20instructions%20on%20how%20to%20use%20one%20for%20the%20particular%20problem.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EThanks%2CMatt%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-123726%22%20slang%3D%22en-US%22%3ERe%3A%20Counting%20words%20in%20one%20column%20based%20on%20dates%20in%20another%20column.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-123726%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Matt%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDid%20you%20try%20PivotTable%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E
Matt Walje
Occasional Contributor

Hi Everyone,

 

I am looking for help coming up with a formula to do the following...

 

In the A column I have a clients status which is either "Completed", "AMA", or "Admin'

In the B column I have a discharge date which ranges from Jan 2015 to November 2017

 

What I'm looking to do is count the occurrences of of the clients status by month over the past 3 years. For example I want to see the count of how many clients were Completed, AMA, or Admin between January 1st 2015 and January 31st 2015 and then so on month by month until October 2017 broken down by month.

 

I've tried to look around to find a formula that would consider the date in Column B and then look at the status word in column A to count but have had not luck.  

 

Any help with this is much appreciated.

Thank You

9 Replies

Hi Matt,

 

Did you try PivotTable?

Hi Sergei,

 

No I have not.  I am rather new to excel and am not familiar with Pivot Tables or how they work.  Can you provide any instructions on how to use one for the particular problem.


Thanks,
Matt

Matt,

 

First two links I found with PivotTable basics

https://support.office.com/en-us/article/Create-a-PivotTable-to-analyze-worksheet-data-A9A84538-BFE9...

 

http://www.excel-easy.com/data-analysis/pivot-tables.html,

 

google will give much more.

 

For your case

Better if you work with Excel Tables, if not the range works as well. Select one which is with your data,

in ribbon Insert->Pivot Table. 

PivotTable pane will appear, add Date to rows, Status to Columns and Values. Result looks like

PivotTable.JPG

 

After that is adjusting - how to group dates, how to design the table.

Hi Segey and Matt
why not use countifs?

Yossi

Hi Yossi,

 

For such kind of tasks formulas (COUNTIFS, SUMPRODUCT, whatever) is less flexible and more time consuming solution compare to PivotTables.

 

With formulas you have to build manually resulting table, add formulas to it, test them to be sure they work correctly. And repeat the same if one day you add/change the status, decide to calculate averages not only counts, etc.

 

PivotTable, especially in combination with Table, gives the same in couple of clicks. With adding new data you shall expand resulting table with formulas manually, with PivotTable just refresh it.

Sergei and Yossi,

 

Thanks for both of your inputs on this.  I started messing around with pivot tables and I do see that they will be easier to use in the future once I get more familiar with them.  In the meantime I was able to use the following formula to achieve my goal.

 

=COUNTIFS($A$2:$A$480,">=1/1/2016",$A$2:$A$480,"<=3/31/2016",$B$2:$B$480,"*Admin*") 

 

Then I would simply change dates, or the word to get what I was looking for for that particular part of the table I was building.

 

Thanks again to you both. 

Hi Matt,

 

When perhaps easier and more reliable will be if you define start and end dates of you periods in the sheet cells (you may use

 

=EDATE(<date>,3)

not to enter all dates manually)

 

and for such data structure

Counting.JPG

the formula in F3 will be

 

=COUNTIFS($A$2:$A$600,">="&$D3,$A$2:$A$600,"<="&$E3,$B$2:$B$600,F$2)

you may frag it down and when entire column to the right.

 

The alternative (in L3) is

 

=SUMPRODUCT(($A$2:$A$600>=$J3)*($A$2:$A$600<=$K3)*(ISNUMBER(SEARCH(L$2,$B$2:$B$600))))

With this it's not necessary to correct the formula for each period/status. However, if you range with data will be out of one defined in formula you have to correct the formulas again.

 

 

From that point of view (and not only) better to convert you range into the table -stay on any cell within it and press Ctrl+T.

It looks like

CountingTable.JPG

and above formulas could be transferred to

 

=COUNTIFS(Table1[Date],">="&$D3,Table1[Date],"<="&$E3,Table1[Status],F$2)

and

 

=SUMPRODUCT((Table1[Date]>=$J3)*(Table1[Date]<=$K3)*(ISNUMBER(SEARCH(L$2,Table1[Status]))))

sure instead of adding "*" in columns names you may use

, "*" & F$2 & "*" 

in first formulas.

Sample is attached

 

 

 

 

@Sergei Baklan 

I stumbled upon this discussion when trying to solve a similar issue and pivot tables completely changed everything for me. I had a little bit of time to understand the basics and I can't believe I hadn't been using them all along. Thank you for your input on this question!

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
21 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
flashing a white screen while open new tab
cntvertex in Discussions on
12 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
28 Replies