Partial match vlookup in a sentence - google-sheets

https://docs.google.com/spreadsheets/d/16NqKD4OGVAwwVK38dht1_NbFrMxkSSIeTXvxOcYXCRg/edit?usp=sharing
Do you do a partial vlookup, searching for a word in a sentence? I have downloaded my bank statement CSV and the description of the payment is quite long-winded, I am looking to categorize each payment. In this example, I am looking to categorize 'Waitrose' as a 'Grocery' purchase.
Please feel free to try formula and make edits to the sheet, thanks!

=ARRAYFORMULA(IFERROR(VLOOKUP(REGEXEXTRACT(C2:C,
TEXTJOIN("|", 1, Category!D2:D)), Category!D2:F, {1, 2, 3}, 0)))

Related

Using COUNTIF with the Array Formula

I'm trying to get a simple COUNTIF formula to combine with the Array Formula in order to count the number of zeros in each row. The original basic formula would look like this:
=COUNTIF($C6:$CD6,"0")
I would want the formula to go down so that it counts the number of zeros in each row.
Please could someone tell me which formula to use? I've tried countless versions with Arrayformula and none of them are working the way I want them to.
Thank you.
EDIT/ADDITION: I've used the formula below to count the zeros in a row.
=ArrayFormula(IF(ISBLANK($A6:$A),,INDEX(MMULT(1*(IF($CH6:$DA="", "×", $CH6:$DA)=0), SEQUENCE(COLUMNS($CH6:$DA), 1, 1, )))))
I have used another formula (below) to sum the amounts in certain columns (which are categorised).
=ArrayFormula(IF(ISBLANK($A5:$A),,SUMIF(IF(($C$2:$CD$2)="Alphabet",ROW($C$5:$C)),ROW($C5:$CD),$C5:$CD)))
In addition to this, I've realised it would be helpful to be able to count the zeros in those same columns. That means I would kind of combine the two formulas above.
Is there a way to do this, please?
try:
=INDEX(MMULT(1*(IF(A1:D4="", "×", A1:D4)=0), SEQUENCE(COLUMNS(A1:D1), 1, 1, )))

How to use ArrayFormula with my Sum fuctions?

Google Sheet Here
I am new to Google sheet and can't figure a good way to do this.
I have tried doing the manual addition way, I got the idea, but am clueless on how to use in my own function :
= ArrayFormula(SUM
(Product (SUMIF(F2:L,"=4"),p_4),
Product (SUMIF(F2:L,"=3"),p_3),
Product (SUMIF(F2:L,"=2"),p_2),
Product (SUMIF(F2:L,"=1"),p_1)))
Also, I am doing this so that the data from Google Form can get auto calculated.
use:
=ARRAYFORMULA(IF(A2:A="",,MMULT(IFNA(F2:L*
VLOOKUP(F2:L, 'Price Sheet'!A:B, 2, ), 0),
SEQUENCE(COLUMNS(F:L), 1, 1, ))))

Google sheets, how to create a table of Vlookup and get the last occurrence for each customer

I have a database of customers, where his zone, seller and some other values can change, and I want to generate a table of the last occurrence of each one
Heres a demo sheet
using Vlookup doesn't get the last occurrence
My database is very big and I need something to not slow my sheet that much, because I was using a formula like this one for each cell
=ARRAYFORMULA(LOOKUP(2,1/(C2:C=A2),$D$2:$D))
but the sheet is very slow because of this
Any help on this please ?
use:
=ARRAY_CONSTRAIN(SORTN(SORT({C3:E, B3:B}, 4, 0), 9^9, 2, 1, 1), 9^9, 3)

Multi Dimension Index-Match

I'm stuck with this assignment where I need to use index-match formula to input values from another sheet.
Google Sheet: https://docs.google.com/spreadsheets/d/182b4foaNURrAysA9pQ2rtFinU0U1TnwBDNHEkInbjiQ/edit?usp=sharing
I need to get value from Sheet "Mon-Sun" to show in the sheet "Work hour" using formula. My friend said I should use index-match, but I cannot seem to be able to do it (Only know how to do basic index-match). Been thinking for hours now but cannot find the solution. Please help.
Perhaps the following, which is just an INDEX with two MATCH's (ID and day of the week), and a bit of logic to handle your setup with merged cells, as well as whether it's Day or Night.
=index('Mon-Sun'!$B$3:$O$6,match($A4,'Mon-Sun'!$A$3:$A$6,0),match(if(isblank(C$2),B$2,C$2),'Mon-Sun'!$B$1:$O$1,0)+if(C$3="Day",0,1))
delete everything in range C4:Z
paste this in C4 cell and drag to the right:
=ARRAYFORMULA(IFNA(VLOOKUP($A4:$A, {'Mon-Sun'!$A3:$A, INDIRECT("Mon-Sun!"&ADDRESS(3,
MATCH(IF(C2="", B2, C2), 'Mon-Sun'!1:1, 0)+IF(C2="", 1, 0), 4)&":"&ADDRESS(ROWS('Mon-Sun'!A:A),
MATCH(IF(C2="", B2, C2), 'Mon-Sun'!1:1, 0)+IF(C2="", 1, 0), 4))}, 2, 0)))

Comparing attributes from 2 sets

I have 2 sets of data, let's say, Workers and Platform. Both have attributes, say, Drilling, Grinding, Hammering.
I need a way to compare, in Excel, the attributes for each element within both sets. For example, if Platform A requires Hammering and Drilling, and Worker A has Drilling, Grinding and Hammering, he'd be accepted for platform A. Worker B only has Drilling, so he'd be rejected at platform B.
The following spreadsheet illustrates this clearly:
https://docs.google.com/spreadsheets/d/1qvkZbDNIWe9gmFjGNr4dhtvqagJZOkS89YD4fzqjvQQ/edit?usp=sharing
In the sheet, "Canta Baila Pinta" are the attributes. The solution I've come up so far is:
Generate a string for each Worker and Platform, which equals to its attributes
How do I compare both strings as if to ask, "Does string B contain any element not present in B?"
Furthermore, this code is not dynamic... how would you go about making it so that any newly added attribute got processed automatically, without user intervention?
This isn't dynamic, but here's another approach that may be of interest:
=ArrayFormula(mmult(if(Trabajadores!E2:G6="Sí",1,0),if(Plataformas!B2:F4="Sí",1,0))=
mmult(transpose(row(Plataformas!B2:F4))^0,if(Plataformas!B2:F4="Sí",1,0)))
The idea is that you multiply the Trabajadores and Plataformas matrices (converting Sí into 1, anything else to zero) to count the number of correspondences in skills for each worker/platform combination. Then you calculate the column totals of requirements in the plataformas matrix by doing another mmult, and finally compare the results to see which workers have the required number of skills for each platform.
delete all your formulae and use these:
=ARRAYFORMULA(
IF(E2:E="Sí", E1, )&
IF(F2:F="Sí", F1, )&
IF(G2:G="Sí", G1, ))
=ARRAYFORMULA(SUBSTITUTE(QUERY(IF(INDIRECT("B2:"&ROW()-1)<>"",
INDIRECT("A2:A"&ROW()-1), ),,999^99), " ", ))
=ARRAYFORMULA(IFERROR(VLOOKUP(A2:A,
{Trabajadores!A:A, Trabajadores!H:H}, 2, 0)&" "&
HLOOKUP(B1:F1, {Plataformas!B1:1; INDIRECT("Plataformas!B"&
MATCH("Endstring", Plataformas!A:A, 0)&":"&
MATCH("Endstring", Plataformas!A:A, 0))}, 2, 0)))
UPDATE:
=ARRAYFORMULA(IFERROR(REGEXMATCH(IFERROR(VLOOKUP(A2:A,
{Trabajadores!A:A, Trabajadores!H:H}, 2, 0)&SUBSTITUTE(COLUMN(B1:F1)^0, 1, )),
SUBSTITUTE(ROW(INDIRECT("A2:A"&COUNTA(A2:A)+1))^0, 1, )&
HLOOKUP(B1:F1, {Plataformas!B1:1; INDIRECT("Plataformas!B"&
MATCH("Endstring", Plataformas!A:A, 0)&":"&
MATCH("Endstring", Plataformas!A:A, 0))}, 2, 0))))
spreadsheet demo

Resources