Need some help with adjusting the formula so it can pick up specific word within the string but the string will be of variable lengths before and after that word.
Adjusted accordingly, formula below is what I’m using at the moment in S20:V28 to get the figures I want.
Trouble is it means I need 4 columns; I want to reduce that to 2 so that S20:S28 will show ALL eBay purchase values and T20:T28 will show ALL Amazon
Adjusted accordingly, formula below is what I’m using at the moment in S20:V28 to get the figures I want.
Excel Formula:
{=IF(COUNTIF($R$5:$R16,S17&"*")>=ROWS(S20:S20),INDEX($S$5:S16,SMALL(IF(LEFT($R$5:$R16,LEN(S17))=S17,ROW($R$5:$R16)-ROW($R$5)+1),ROWS(S20:S20))),"")}
Trouble is it means I need 4 columns; I want to reduce that to 2 so that S20:S28 will show ALL eBay purchase values and T20:T28 will show ALL Amazon
Accounts 2016 - 2019 Currant.xlsm | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
O | P | Q | R | S | T | U | V | W | X | Y | Z | AA | AB | AC | AD | |||
1 | ||||||||||||||||||
2 | CASH BOOK | April 6th 2020 - April 5th 2021 | ||||||||||||||||
3 | DEBITS | |||||||||||||||||
4 | Date | Invoice # | Payment Method List | Payment Details List | Bank & Cash | Gen Insur Office Postage/ Stationary | ||||||||||||
5 | ||||||||||||||||||
6 | Jul-15 | gs0370 | PayPal | eBay Apples | 5.00 | 5.00 | ||||||||||||
7 | Jul-20 | gs0375 | PayPal | Office eBay print paper | 10.00 | 10.00 | ||||||||||||
8 | Jul-20 | gs0380 | PayPal | eBay Pears | 15.00 | 15.00 | ||||||||||||
9 | Jul-20 | gs0385 | Debit Card | Amazon | 20.00 | 20.00 | ||||||||||||
10 | Jul-20 | gs0390 | Debit Card | Office Amazon - Note books | 25.00 | 25.00 | ||||||||||||
11 | Jul-22 | gs0415 | PayPal | Office eBay - Print cartridges | 30.00 | 30.00 | ||||||||||||
12 | Jul-29 | gs0433 | Debit Card | Amazon | 35.00 | 35.00 | ||||||||||||
13 | Desired out come for S20:S28 & T20:T28 | |||||||||||||||||
14 | ||||||||||||||||||
15 | ||||||||||||||||||
16 | ||||||||||||||||||
17 | eBay | Office ebay | Amazon | Office Amazon | All eBay | All Amazon | ||||||||||||
18 | Details Office | Office | ||||||||||||||||
19 | eBay print paper | 10.00 | ||||||||||||||||
20 | Amazon - Note books | 25.00 | 5.00 | 10.00 | 20.00 | 25.00 | 5.00 | 20.00 | ||||||||||
21 | eBay - Print cartridges | 30.00 | 15.00 | 30.00 | 35.00 | 10.00 | 25.00 | |||||||||||
22 | 15.00 | 35.00 | ||||||||||||||||
23 | 30.00 | |||||||||||||||||
24 | ||||||||||||||||||
25 | ||||||||||||||||||
26 | ||||||||||||||||||
27 | ||||||||||||||||||
28 | 65.00 | |||||||||||||||||
29 | ||||||||||||||||||
30 | ||||||||||||||||||
April 20 - 21 (2) |
Cell Formulas | ||
---|---|---|
Range | Formula | |
R17 | R17 | =IF(COUNTIF($R$5:$R16,#REF!&"*")>=ROWS(R17:R17), INDEX($AC$5:$AC16,SMALL(IF(LEFT($R$5:$R16,LEN(#REF!))=#REF!,ROW($R$5:$R16)-ROW($R$5)+1),ROWS(R17:R17))),0) |
R19 | R19 | =IF(COUNTIF($R$5:$R16,R18&"*")>=ROWS(R19:R19), INDEX($AC$5:$AC16,SMALL(IF(LEFT($R$5:$R16,LEN(R18))=R18,ROW($R$5:$R16)-ROW($R$5)+1),ROWS(R19:R19))),0) |
R20 | R20 | =IF(COUNTIF($R$5:$R16,R18&"*")>=ROWS(R19:R20), INDEX($AC$5:$AC16,SMALL(IF(LEFT($R$5:$R16,LEN(R18))=R18,ROW($R$5:$R16)-ROW($R$5)+1),ROWS(R19:R20))),0) |
S20 | S20 | =IF(COUNTIF($R$5:$R16,S17&"*")>=ROWS(S20:S20), INDEX($S$5:S16,SMALL(IF(LEFT($R$5:$R16,LEN(S17))=S17,ROW($R$5:$R16)-ROW($R$5)+1),ROWS(S20:S20))),"") |
T20 | T20 | =IF(COUNTIF($R$5:$R$16,T17&"*")>=ROWS(T$20:T20), INDEX($S$5:S$16,SMALL(IF(LEFT($R$5:$R$16,LEN(T$17))=T$17,ROW($R$5:$R$16)-ROW($R$5)+1),ROWS(T$20:T20))),"") |
U20:U28 | U20 | = IF(SUMPRODUCT(--($R$5:$R$16=U$17))>=ROWS(U$20:U20),INDEX($S$5:$S$16,SMALL(IF($R$5:$R$16=U$17,ROW($R$5:$R$16)-ROW($R$5)+1),ROWS(U$20:U20))),"") |
V20 | V20 | =IF(COUNTIF($R$5:$R$16,V17&"*")>=ROWS(V$20:V20), INDEX($S$5:S$16,SMALL(IF(LEFT($R$5:$R$16,LEN(V$17))=V$17,ROW($R$5:$R$16)-ROW($R$5)+1),ROWS(V$20:V20))),"") |
R21 | R21 | =IF(COUNTIF($R$5:$R16,R18&"*")>=ROWS(R19:R21), INDEX($AC$5:$AC16,SMALL(IF(LEFT($R$5:$R16,LEN(R18))=R18,ROW($R$5:$R16)-ROW($R$5)+1),ROWS(R19:R21))),0) |
S21 | S21 | =IF(COUNTIF($R$5:$R16,S17&"*")>=ROWS(S20:S21), INDEX($S$5:S16,SMALL(IF(LEFT($R$5:$R16,LEN(S17))=S17,ROW($R$5:$R16)-ROW($R$5)+1),ROWS(S20:S21))),"") |
T21 | T21 | =IF(COUNTIF($R$5:$R$16,T17&"*")>=ROWS(T$20:T21), INDEX($S$5:S$16,SMALL(IF(LEFT($R$5:$R$16,LEN(T$17))=T$17,ROW($R$5:$R$16)-ROW($R$5)+1),ROWS(T$20:T21))),"") |
V21 | V21 | =IF(COUNTIF($R$5:$R$16,V17&"*")>=ROWS(V$20:V21), INDEX($S$5:S$16,SMALL(IF(LEFT($R$5:$R$16,LEN(V$17))=V$17,ROW($R$5:$R$16)-ROW($R$5)+1),ROWS(V$20:V21))),"") |
R22 | R22 | =IF(COUNTIF($R$5:$R16,R18&"*")>=ROWS(R19:R22), INDEX($AC$5:$AC16,SMALL(IF(LEFT($R$5:$R16,LEN(R18))=R18,ROW($R$5:$R16)-ROW($R$5)+1),ROWS(R19:R22))),0) |
S22 | S22 | =IF(COUNTIF($R$5:$R16,S17&"*")>=ROWS(S20:S22), INDEX($S$5:S16,SMALL(IF(LEFT($R$5:$R16,LEN(S17))=S17,ROW($R$5:$R16)-ROW($R$5)+1),ROWS(S20:S22))),"") |
T22 | T22 | =IF(COUNTIF($R$5:$R$16,T17&"*")>=ROWS(T$20:T22), INDEX($S$5:S$16,SMALL(IF(LEFT($R$5:$R$16,LEN(T$17))=T$17,ROW($R$5:$R$16)-ROW($R$5)+1),ROWS(T$20:T22))),"") |
V22 | V22 | =IF(COUNTIF($R$5:$R$16,V17&"*")>=ROWS(V$20:V22), INDEX($S$5:S$16,SMALL(IF(LEFT($R$5:$R$16,LEN(V$17))=V$17,ROW($R$5:$R$16)-ROW($R$5)+1),ROWS(V$20:V22))),"") |
R23 | R23 | =IF(COUNTIF($R$5:$R16,R18&"*")>=ROWS(R19:R23), INDEX($AC$5:$AC16,SMALL(IF(LEFT($R$5:$R16,LEN(R18))=R18,ROW($R$5:$R16)-ROW($R$5)+1),ROWS(R19:R23))),0) |
S23 | S23 | =IF(COUNTIF($R$5:$R16,S17&"*")>=ROWS(S20:S23), INDEX($S$5:S16,SMALL(IF(LEFT($R$5:$R16,LEN(S17))=S17,ROW($R$5:$R16)-ROW($R$5)+1),ROWS(S20:S23))),"") |
T23 | T23 | =IF(COUNTIF($R$5:$R$16,T17&"*")>=ROWS(T$20:T23), INDEX($S$5:S$16,SMALL(IF(LEFT($R$5:$R$16,LEN(T$17))=T$17,ROW($R$5:$R$16)-ROW($R$5)+1),ROWS(T$20:T23))),"") |
V23 | V23 | =IF(COUNTIF($R$5:$R$16,V17&"*")>=ROWS(V$20:V23), INDEX($S$5:S$16,SMALL(IF(LEFT($R$5:$R$16,LEN(V$17))=V$17,ROW($R$5:$R$16)-ROW($R$5)+1),ROWS(V$20:V23))),"") |
R24 | R24 | =IF(COUNTIF($R$5:$R16,R18&"*")>=ROWS(R19:R24), INDEX($AC$5:$AC16,SMALL(IF(LEFT($R$5:$R16,LEN(R18))=R18,ROW($R$5:$R16)-ROW($R$5)+1),ROWS(R19:R24))),0) |
S24 | S24 | =IF(COUNTIF($R$5:$R16,S17&"*")>=ROWS(S20:S24), INDEX($S$5:S16,SMALL(IF(LEFT($R$5:$R16,LEN(S17))=S17,ROW($R$5:$R16)-ROW($R$5)+1),ROWS(S20:S24))),"") |
T24 | T24 | =IF(COUNTIF($R$5:$R$16,T17&"*")>=ROWS(T$20:T24), INDEX($S$5:S$16,SMALL(IF(LEFT($R$5:$R$16,LEN(T$17))=T$17,ROW($R$5:$R$16)-ROW($R$5)+1),ROWS(T$20:T24))),"") |
V24 | V24 | =IF(COUNTIF($R$5:$R$16,V17&"*")>=ROWS(V$20:V24), INDEX($S$5:S$16,SMALL(IF(LEFT($R$5:$R$16,LEN(V$17))=V$17,ROW($R$5:$R$16)-ROW($R$5)+1),ROWS(V$20:V24))),"") |
R25 | R25 | =IF(COUNTIF($R$5:$R16,R18&"*")>=ROWS(R19:R25), INDEX($AC$5:$AC16,SMALL(IF(LEFT($R$5:$R16,LEN(R18))=R18,ROW($R$5:$R16)-ROW($R$5)+1),ROWS(R19:R25))),0) |
S25 | S25 | =IF(COUNTIF($R$5:$R16,S17&"*")>=ROWS(S20:S25), INDEX($S$5:S16,SMALL(IF(LEFT($R$5:$R16,LEN(S17))=S17,ROW($R$5:$R16)-ROW($R$5)+1),ROWS(S20:S25))),"") |
T25 | T25 | =IF(COUNTIF($R$5:$R$16,T17&"*")>=ROWS(T$20:T25), INDEX($S$5:S$16,SMALL(IF(LEFT($R$5:$R$16,LEN(T$17))=T$17,ROW($R$5:$R$16)-ROW($R$5)+1),ROWS(T$20:T25))),"") |
V25 | V25 | =IF(COUNTIF($R$5:$R$16,V17&"*")>=ROWS(V$20:V25), INDEX($S$5:S$16,SMALL(IF(LEFT($R$5:$R$16,LEN(V$17))=V$17,ROW($R$5:$R$16)-ROW($R$5)+1),ROWS(V$20:V25))),"") |
R26 | R26 | =IF(COUNTIF($R$5:$R16,R18&"*")>=ROWS(R19:R26), INDEX($AC$5:$AC16,SMALL(IF(LEFT($R$5:$R16,LEN(R18))=R18,ROW($R$5:$R16)-ROW($R$5)+1),ROWS(R19:R26))),0) |
S26 | S26 | =IF(COUNTIF($R$5:$R16,S17&"*")>=ROWS(S20:S26), INDEX($S$5:S16,SMALL(IF(LEFT($R$5:$R16,LEN(S17))=S17,ROW($R$5:$R16)-ROW($R$5)+1),ROWS(S20:S26))),"") |
T26 | T26 | =IF(COUNTIF($R$5:$R$16,T17&"*")>=ROWS(T$20:T26), INDEX($S$5:S$16,SMALL(IF(LEFT($R$5:$R$16,LEN(T$17))=T$17,ROW($R$5:$R$16)-ROW($R$5)+1),ROWS(T$20:T26))),"") |
V26 | V26 | =IF(COUNTIF($R$5:$R$16,V17&"*")>=ROWS(V$20:V26), INDEX($S$5:S$16,SMALL(IF(LEFT($R$5:$R$16,LEN(V$17))=V$17,ROW($R$5:$R$16)-ROW($R$5)+1),ROWS(V$20:V26))),"") |
R27 | R27 | =IF(COUNTIF($R$5:$R16,R18&"*")>=ROWS(R19:R27), INDEX($AC$5:$AC16,SMALL(IF(LEFT($R$5:$R16,LEN(R18))=R18,ROW($R$5:$R16)-ROW($R$5)+1),ROWS(R19:R27))),0) |
S27 | S27 | =IF(COUNTIF($R$5:$R16,S17&"*")>=ROWS(S20:S27), INDEX($S$5:S16,SMALL(IF(LEFT($R$5:$R16,LEN(S17))=S17,ROW($R$5:$R16)-ROW($R$5)+1),ROWS(S20:S27))),"") |
T27 | T27 | =IF(COUNTIF($R$5:$R$16,T17&"*")>=ROWS(T$20:T27), INDEX($S$5:S$16,SMALL(IF(LEFT($R$5:$R$16,LEN(T$17))=T$17,ROW($R$5:$R$16)-ROW($R$5)+1),ROWS(T$20:T27))),"") |
V27 | V27 | =IF(COUNTIF($R$5:$R$16,V17&"*")>=ROWS(V$20:V27), INDEX($S$5:S$16,SMALL(IF(LEFT($R$5:$R$16,LEN(V$17))=V$17,ROW($R$5:$R$16)-ROW($R$5)+1),ROWS(V$20:V27))),"") |
R28 | R28 | =SUM(R$19:R27) |
S28 | S28 | =IF(COUNTIF($R$5:$R16,S17&"*")>=ROWS(S20:S28), INDEX($S$5:S16,SMALL(IF(LEFT($R$5:$R16,LEN(S17))=S17,ROW($R$5:$R16)-ROW($R$5)+1),ROWS(S20:S28))),"") |
T28 | T28 | =IF(COUNTIF($R$5:$R$16,T17&"*")>=ROWS(T$20:T28), INDEX($S$5:S$16,SMALL(IF(LEFT($R$5:$R$16,LEN(T$17))=T$17,ROW($R$5:$R$16)-ROW($R$5)+1),ROWS(T$20:T28))),"") |
V28 | V28 | =IF(COUNTIF($R$5:$R$16,V17&"*")>=ROWS(V$20:V28), INDEX($S$5:S$16,SMALL(IF(LEFT($R$5:$R$16,LEN(V$17))=V$17,ROW($R$5:$R$16)-ROW($R$5)+1),ROWS(V$20:V28))),"") |
Q19 | Q19 | =TRIM(REPLACE(IF($R19>0,INDEX(R$5:R16,SMALL(IF(AC$5:AC16=R19,ROW(R$5:R16)-ROW(R$5)+1),COUNTIF(R19:R19,R19)))),1,6,"")) |
Q20 | Q20 | =TRIM(REPLACE(IF($R20>0,INDEX(R$5:R16,SMALL(IF(AC$5:AC16=R20,ROW(R$5:R16)-ROW(R$5)+1),COUNTIF(R19:R20,R20)))),1,6,"")) |
Q21 | Q21 | =TRIM(REPLACE(IF($R21>0,INDEX(R$5:R16,SMALL(IF(AC$5:AC16=R21,ROW(R$5:R16)-ROW(R$5)+1),COUNTIF(R19:R21,R21)))),1,6,"")) |
Q22 | Q22 | =TRIM(REPLACE(IF($R22>0,INDEX(R$5:R16,SMALL(IF(AC$5:AC16=R22,ROW(R$5:R16)-ROW(R$5)+1),COUNTIF(R19:R22,R22)))),1,6,"")) |
Q23 | Q23 | =TRIM(REPLACE(IF($R23>0,INDEX(R$5:R16,SMALL(IF(AC$5:AC16=R23,ROW(R$5:R16)-ROW(R$5)+1),COUNTIF(R19:R23,R23)))),1,6,"")) |
Q24 | Q24 | =TRIM(REPLACE(IF($R24>0,INDEX(R$5:R16,SMALL(IF(AC$5:AC16=R24,ROW(R$5:R16)-ROW(R$5)+1),COUNTIF(R19:R24,R24)))),1,6,"")) |
Q25 | Q25 | =TRIM(REPLACE(IF($R25>0,INDEX(R$5:R16,SMALL(IF(AC$5:AC16=R25,ROW(R$5:R16)-ROW(R$5)+1),COUNTIF(R19:R25,R25)))),1,6,"")) |
Q26 | Q26 | =TRIM(REPLACE(IF($R26>0,INDEX(R$5:R16,SMALL(IF(AC$5:AC16=R26,ROW(R$5:R16)-ROW(R$5)+1),COUNTIF(R19:R26,R26)))),1,6,"")) |
Q27 | Q27 | =TRIM(REPLACE(IF($R27>0,INDEX(R$5:R16,SMALL(IF(AC$5:AC16=R27,ROW(R$5:R16)-ROW(R$5)+1),COUNTIF(R19:R27,R27)))),1,6,"")) |
Press CTRL+SHIFT+ENTER to enter array formulas. |
Cells with Conditional Formatting | ||||
---|---|---|---|---|
Cell | Condition | Cell Format | Stop If True | |
Q19:Q27 | Expression | =R19>0 | text | YES |
P19:P28 | Expression | =R19>0 | text | YES |
Q28 | Expression | =$R28>0 | text | YES |