SOLVED

SOLVED - Dynamic/spill array formula to show result finite amount of times based on criteria

%3CLINGO-SUB%20id%3D%22lingo-sub-3355191%22%20slang%3D%22en-US%22%3ERe%3A%20SOLVED%20-%20Dynamic%2Fspill%20array%20formula%20to%20show%20result%20finite%20amount%20of%20times%20based%20on%20criteria%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3355191%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSTRONG%3EUpdate%3A%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20figured%20it%20out.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20idea%20I%20had%20was%3A%20everything%20below%2Fabove%20(below%20in%20my%20case)%20each%20cell%20will%20see%20if%20%22Mismatch%22%20with%20the%20existing%20value%20next%20to%20it%20already%20exists.%20So%2C%20the%20first%20thing%20I%20had%20to%20do%20was%20count%20the%20occurrences%20of%20the%20value%20under%20Bank%20and%20under%20Tracker%20then%20subtract%20for%20the%20difference.%20Then%2C%20the%20difference%20was%20how%20many%20times%20%22Mismatch%22%20would%20appear%20for%20the%20value%2C%20in%20the%20array.%20Finally%2C%20for%20it%20to%20be%20a%20dynamic%20array%20(spill)%2C%20I%20used%20the%20SEQUENCE%20function%20to%20increment%201%20to%20the%20start%20of%20the%20range%20reference%20in%20the%20COUNTIF%20function%20used%20to%20check%20all%20below.%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22POST.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F370663iC5E86D191D28547E%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22POST.png%22%20alt%3D%22POST.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EIt's%20not%20100%25%20accurate%20as%20far%20as%20which%20one(s)%20weren't%20logged%20right%20(being%20the%20order)%20but%20in%20my%20case%2C%20I'm%20not%20concerned%20with%20the%20dates%20as%20long%20as%20they're%20all%20from%20the%201st%20of%20the%20month%20to%20the%20current%20date%20-%20is%20the%20match%20of%20each%20value%20that%20matters.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CEM%3EFormula%20(column%20G)%3A%3C%2FEM%3E%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3DIFERROR(IF(%24E%243%3A%24E%241000%3D%22%22%2C%22%22%2CIF(COUNTIF(%24B%243%3A%24B%241000%2C%24E%243%3A%24E%241000)%3DCOUNTIF(%24E%243%3A%24E%241000%2C%24E%243%3A%24E%241000)%2C%22%E2%9C%93%22%2CIF(COUNTIF(INDIRECT(%22E%22%26amp%3B3%2BSEQUENCE(998%2C1%2C%2C1)%26amp%3B%22%3A%24E%241001%22)%2C%24E%243%3A%24E%241000)%3CCOUNTIF%3E%3C%2FCOUNTIF%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%3CEM%3EFormula%20(for%20Flash%20Fill)%3A%3C%2FEM%3E%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3DIF(D3%3D%22%22%2C%22%22%2CIF(COUNTIF(%24B%243%3A%24B%241000%2CD3)%3DCOUNTIF(%24D%243%3A%24D%241000%2CD3)%2C%22%E2%9C%93%22%2CIF(COUNTIF(D4%3A%24D%241001%2CD3)%3CCOUNTIF%3E%3C%2FCOUNTIF%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%3CEM%3ENote%3A%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EThe%20%22ref_text%22%20in%20the%20INDIRECT%20function%20is%20entered%20as%20a%20string%20thus%20does%20not%20automatically%20account%20for%20column%2Frow%20reference%20updates%20and%20will%20need%20to%20be%20updated%20manually.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAttached%20is%20a%20sample%20.xlsx%20workbook%20I%20made%20so%20y'all%20can%20update%20the%20formula%20to%20your%20needs.%20Feel%20free%20to%20share%20your%20tweaks%20or%20suggestions%20for%20better%20ways%20to%20accomplish%20this.%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-3347747%22%20slang%3D%22en-US%22%3ESOLVED%20-%20Dynamic%2Fspill%20array%20formula%20to%20show%20result%20finite%20amount%20of%20times%20based%20on%20criteria%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3347747%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20log%20that%20I'm%20comparing%20to%20my%20bank%20and%20have%20solved%20all%20the%20issues%20so%20far%2C%20except%20for%20how%20to%20state%20duplicated%20logs.%3CBR%20%2F%3E%3CBR%20%2F%3EIn%20my%20list%2C%20my%20formula%20in%20column%20E%20will%20state%20%22Mismatch%22%20if%20the%20amount%20of%20occurrences%20in%20column%20B%20is%20not%20the%20same%20amount%20of%20occurrences%20in%20column%20D%20(or%20if%20an%20item%20doesn't%20exist)%2C%20for%20each%20item.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20this%20picture%2C%20%3CU%3E%3CSTRONG%3E-59.82%20withdrew%20once%3C%2FSTRONG%3E%3C%2FU%3E%20from%20the%20bank%20but%20%3CSTRONG%3E%3CU%3EI%20%3C%2FU%3E%3CU%3El%3C%2FU%3E%3CU%3Eogged%20it%20twice%20in%20my%20tracke%3C%2FU%3E%3CU%3Er%3C%2FU%3E%3C%2FSTRONG%3E%20by%20accident%2C%20thus%20%3CSTRONG%3E%3CU%3E1%20of%20the%202%20%22Mismatch%22's%20are%20true%20but%20not%20both%20of%20them%3C%2FU%3E%3C%2FSTRONG%3E.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22POST%20ON%20TECH.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F370357iF3DBDF02094A66D8%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22POST%20ON%20TECH.png%22%20alt%3D%22POST%20ON%20TECH.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20need%20my%20formula%20to%20show%20%22Mismatch%22%20for%20the%20number%20of%20times%20it%20was%20duplicated.%20(E.g.%20%2450%20appears%20twice%20in%20my%20bank%20statement%20but%20appears%205%20times%20in%20the%20tracker%20logs%2C%20meaning%203%20of%205%20are%20mismatches.)%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%3CEM%3EFormula%20(column%20E)%3A%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3DIF(D3%3AD1000%3D%22%22%2C%22%22%2CIF(COUNTIF(B3%3AB1000%2CD3%3AD1000)%3DCOUNTIF(D3%3AD1000%2CD3%3AD1000)%2C%22%E2%9C%93%22%2C%22Mismatch%22))%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CEM%3ENotes%3A%3C%2FEM%3E%3C%2FP%3E%3CP%3E%E2%80%A2%20All%20arrays%20shown%20are%20dynamic%20arrays%20(or%20spills).%3C%2FP%3E%3CP%3E%E2%80%A2%20%22List%20of%20Mismatches%22%20lists%20the%20value(s)%20of%20item(s)%20from%20column%20B%2FD%20where%20%22Mismatch%22%20is%20to%20the%20right%20of%20it.%3C%2FP%3E%3CP%3E%E2%80%A2%20Filter%20from%20the%20Data%20tab%20is%20turned%20on%20for%20columns%20B%3AE%2C%20there%20is%20no%20table%20inserted.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20would%20highly%20appreciate%20any%20solution%20to%20this.%20Thank%20you!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3347747%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EBI%20%26amp%3B%20Data%20Analysis%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Contributor

I have a log that I'm comparing to my bank and have solved all the issues so far, except for how to state duplicated logs.

In my list, my formula in column E will state "Mismatch" if the amount of occurrences in column B is not the same amount of occurrences in column D (or if an item doesn't exist), for each item.

 

In this picture, -59.82 withdrew once from the bank but I logged it twice in my tracker by accident, thus 1 of the 2 "Mismatch"'s are true but not both of them.

POST ON TECH.png

 

I need my formula to show "Mismatch" for the number of times it was duplicated. (E.g. $50 appears twice in my bank statement but appears 5 times in the tracker logs, meaning 3 of 5 are mismatches.)

 

 

 

Formula (column E):

 

=IF(D3:D1000="","",IF(COUNTIF(B3:B1000,D3:D1000)=COUNTIF(D3:D1000,D3:D1000),"✓","Mismatch"))

 

Notes:

• All arrays shown are dynamic arrays (or spills).

• "List of Mismatches" lists the value(s) of item(s) from column B/D where "Mismatch" is to the right of it.

• Filter from the Data tab is turned on for columns B:E, there is no table inserted.

 

I would highly appreciate any solution to this. Thank you!

 

1 Reply
best response confirmed by Kendethar (Contributor)
Solution

Update:

 

I figured it out.

 

The idea I had was: everything below/above (below in my case) each cell will see if "Mismatch" with the existing value next to it already exists. So, the first thing I had to do was count the occurrences of the value under Bank and under Tracker then subtract for the difference. Then, the difference was how many times "Mismatch" would appear for the value, in the array. Finally, for it to be a dynamic array (spill), I used the SEQUENCE function to increment 1 to the start of the range reference in the COUNTIF function used to check all below. 

POST.png

It's not 100% accurate as far as which one(s) weren't logged right (being the order) but in my case, I'm not concerned with the dates as long as they're all from the 1st of the month to the current date - is the match of each value that matters.

 

Formula (column G):

=IFERROR(IF($E$3:$E$1000="","",IF(COUNTIF($B$3:$B$1000,$E$3:$E$1000)=COUNTIF($E$3:$E$1000,$E$3:$E$1000),"✓",IF(COUNTIF(INDIRECT("E"&3+SEQUENCE(998,1,,1)&":$E$1001"),$E$3:$E$1000)<COUNTIF($E$3:$E$1000,$E$3:$E$1000)-COUNTIF($B$3:$B$1000,$E$3:$E$1000),"Mismatch","✓"))),"")

Formula (for Flash Fill):

=IF(D3="","",IF(COUNTIF($B$3:$B$1000,D3)=COUNTIF($D$3:$D$1000,D3),"✓",IF(COUNTIF(D4:$D$1001,D3)<COUNTIF($D$3:$D$1000,D3)-COUNTIF($B$3:$B$1000,D3),"Mismatch","✓")))

Note:

The "ref_text" in the INDIRECT function is entered as a string thus does not automatically account for column/row reference updates and will need to be updated manually.

 

Attached is a sample .xlsx workbook I made so y'all can update the formula to your needs. Feel free to share your tweaks or suggestions for better ways to accomplish this.