Counting with conditions in excel

%3CLINGO-SUB%20id%3D%22lingo-sub-2242063%22%20slang%3D%22en-US%22%3ECounting%20with%20conditions%20in%20excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2242063%22%20slang%3D%22en-US%22%3EHello%20everyone%2C%3CBR%20%2F%3EI%20am%20using%20Excel%202007%20on%20Windows%2010%20and%20have%20some%20troubles%20with%20counting%20in%20excel.%20I%20will%20explain%20it%20in%20example%3A%3CBR%20%2F%3EDATE%201ST%202ND%20SHIPMENT%3CBR%20%2F%3E01.01.2020%20Apple%20Banana%20yes%3CBR%20%2F%3E01.02.2020%20Banana%20Apple%20yes%3CBR%20%2F%3E01.03.2020%20Orange%20Banana%20no%3CBR%20%2F%3E01.04.2020%20Apple%20Orange%20no%3CBR%20%2F%3E01.05.2020%20Apple%20Orange%20yes%3CBR%20%2F%3E01.06.2020%20Orange%20Banana%20yes%3CBR%20%2F%3E01.07.2020%20Banana%20Apple%20yes%3CBR%20%2F%3E01.08.2020%20Apple%20Orange%20yes%3CBR%20%2F%3E01.09.2020%20Apple%20Banana%20yes%3CBR%20%2F%3E01.10.2020%20Banana%20Apple%20yes%3CBR%20%2F%3E01.11.2020%20Apple%20Banana%20yes%3CBR%20%2F%3E01.12.2020%20Apple%20Orange%20no%3CBR%20%2F%3E%3CBR%20%2F%3EI%20want%20to%20count%20several%20things%3A%3CBR%20%2F%3E1)%20how%20many%20times%20combination%20%22apple%22%20in%20column%201ST%20and%20%22yes%22%20in%20column%20SHIPMENT%20appears%20until%20column%20SHIPMENT%20turns%20%22No%22%20starting%20from%20last%20entered%20combination%3F%3CBR%20%2F%3E2)%20how%20many%20times%20combination%20%22apple%22%20in%20column%202ST%20and%20%22yes%22%20in%20column%20SHIPMENT%20appears%20until%20column%20SHIPMENT%20turns%20%22No%22%20starting%20from%20last%20entered%20combination%3F%3CBR%20%2F%3E3)%20how%20many%20times%20combination%20%22apple%22%20in%20column%201ST%20or%20column%202ND%20and%20%22yes%22%20in%20column%20SHIPMENT%20appears%20until%20column%20SHIPMENT%20turns%20%22No%22%20starting%20from%20last%20entered%20combination%3F%3CBR%20%2F%3EThank%20you%20for%20help.%3CBR%20%2F%3EKind%20regards%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2242063%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2242410%22%20slang%3D%22en-US%22%3ERe%3A%20Counting%20with%20conditions%20in%20excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2242410%22%20slang%3D%22en-US%22%3EHi%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F722750%22%20target%3D%22_blank%22%3E%40Nikolino%3C%2FA%3E%2C%3CBR%20%2F%3E%3CBR%20%2F%3EThank%20you%20for%20the%20idea%2C%20but%20it%20seems%20to%20me%20that%20my%20problem%20needs%20some%20additional%20excel%20function%20besides%20CCOUNTIF(S).%20I%20do%20not%20know%20to%20solve%20it%20with%20just%20COUNFIF(S).%3CBR%20%2F%3EObviously%2C%20it's%20too%20complex%20for%20my%20knowledge%20of%20Excel.%3CBR%20%2F%3EI'm%20too%20Socratian%20for%20Excel.%3CBR%20%2F%3E%3CBR%20%2F%3EKind%20regards%2C%3CBR%20%2F%3EStevanBgd%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2242358%22%20slang%3D%22en-US%22%3ERe%3A%20Counting%20with%20conditions%20in%20excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2242358%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1011275%22%20target%3D%22_blank%22%3E%40StevanBgd%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CH1%20id%3D%22toc-hId-1300371664%22%20id%3D%22toc-hId-1300371690%22%3E%3CA%20href%3D%22https%3A%2F%2Fsupport.microsoft.com%2Fen-us%2Foffice%2Fcountif-function-e0de10c6-f885-4e71-abb4-1f464816df34%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3ECOUNTIF%20function%3C%2FA%3E%3C%2FH1%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CH1%20id%3D%22toc-hId--507082799%22%20id%3D%22toc-hId--507082773%22%3E%3CA%20href%3D%22https%3A%2F%2Fsupport.microsoft.com%2Fen-ie%2Foffice%2Fcount-numbers-or-dates-based-on-a-condition-976d0074-245d-49e6-bf5f-1207983f82ed%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3ECount%20numbers%20or%20dates%20based%20on%20a%20condition%3C%2FA%3E%3C%2FH1%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20would%20be%20happy%20to%20know%20if%20I%20could%20help%20with%20this%20information.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENikolino%3C%2FP%3E%3CP%3EI%20know%20I%20don't%20know%20anything%20(Socrates)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor
Hello everyone,
I am using Excel 2007 on Windows 10 and have some troubles with counting in excel. I will explain it in example:
DATE 1ST 2ND SHIPMENT
01.01.2020 Apple Banana yes
01.02.2020 Banana Apple yes
01.03.2020 Orange Banana no
01.04.2020 Apple Orange no
01.05.2020 Apple Orange yes
01.06.2020 Orange Banana yes
01.07.2020 Banana Apple yes
01.08.2020 Apple Orange yes
01.09.2020 Apple Banana yes
01.10.2020 Banana Apple yes
01.11.2020 Apple Banana yes
01.12.2020 Apple Orange no

I want to count several things:
1) how many times combination "apple" in column 1ST and "yes" in column SHIPMENT appears until column SHIPMENT turns "No" starting from last entered combination?
2) how many times combination "apple" in column 2ST and "yes" in column SHIPMENT appears until column SHIPMENT turns "No" starting from last entered combination?
3) how many times combination "apple" in column 1ST or column 2ND and "yes" in column SHIPMENT appears until column SHIPMENT turns "No" starting from last entered combination?
Thank you for help.
Kind regards
4 Replies

@StevanBgd 

 

COUNTIF function

 

Count numbers or dates based on a condition

 

I would be happy to know if I could help with this information.

 

Nikolino

I know I don't know anything (Socrates)

 

Hi @NikolinoDE,

Thank you for the idea, but it seems to me that my problem needs some additional excel function besides CCOUNTIF(S). I do not know to solve it with just COUNFIF(S).
Obviously, it's too complex for my knowledge of Excel.
I'm too Socratian for Excel.

Kind regards,
StevanBgd

@StevanBgd 

 

Here is an old little example with names and amounts.

 

I wish you much success in your project.

 

Nikolino

I know I don't know anything (Socrates)

@StevanBgd 

As variant for such model

image.png

formulas are

in G2:
=IFNA(SUMPRODUCT(
($B$2:INDEX($B$2:$B$13,
            MATCH(1,INDEX(($B$2:$B$13=F2)*($D$2:$D$13="no"),0),0) ) =
   F2)*
  ($D$2:INDEX($D$2:$D$13,
            MATCH(1,INDEX(($B$2:$B$13=F2)*($D$2:$D$13="no"),0),0) ) =
  "yes")), SUMPRODUCT(($B$2:$B$13=F2)*($D$2:$D$13="yes")))

In J2:
=IFNA(SUMPRODUCT(
($C$2:INDEX($C$2:$C$13,
            MATCH(1,INDEX(($C$2:$C$13=I2)*($D$2:$D$13="no"),0),0) ) =
   I2)*
  ($D$2:INDEX($D$2:$D$13,
            MATCH(1,INDEX(($C$2:$C$13=I2)*($D$2:$D$13="no"),0),0) ) =
  "yes")), SUMPRODUCT(($C$2:$C$13=I2)*($D$2:$D$13="yes")))

In M2:
=IFNA(SUMPRODUCT(
(
($B$2:INDEX($B$2:$B$13,
             MATCH(1,INDEX( ( ($B$2:$B$13=L2)+($C$2:$C$13=L2) )*($D$2:$D$13="no"),0),0) ) =
   L2) +
($C$2:INDEX($C$2:$C$13,
             MATCH(1,INDEX( ( ($B$2:$B$13=L2)+($C$2:$C$13=L2) )*($D$2:$D$13="no"),0),0) ) =
   L2)
)
*
  ($D$2:INDEX($D$2:$D$13,
            MATCH(1,INDEX(( ($B$2:$B$13=L2)+($C$2:$C$13=L2) )*($D$2:$D$13="no"),0),0) ) =
  "yes")), SUMPRODUCT(( ($B$2:$B$13=L2)+($C$2:$C$13=L2) )*($D$2:$D$13="yes")))

Hope it shall work on 2007.