ARRAYFORMULA - get value after certain date - google-sheets

I'm building a sheets with the following pages:
Records
Team
Records Page:
Date
Time
Where
User
Pay
01/01/2022
01:40
Warehouse
Mike Silva
14,00$
04/01/2022
07:40
Main Office
Mike Silva
15,00$
Team Page:
Date
User
Pay
01/01/2022
Mike Silva
14,00$
03/01/2022
Mike Silva
15,00$
Up until the 3rd of January Mike had a pay of 14,00$ and from the 3rd onwards is pay was bumped to 15$. I've used INDEX/MATCH to get the pay within the correct date, but I can't get it into a ArrayFormula to auto update all cells.
How would you approach this?

Got the answer after some trial/error.
On team page I created a helper column (User + Date):
Date
Helper
User
Pay
01/01/2022
Mike Silva|44562
14,00$
Mike Silva
03/01/2022
Mike Silva|44564
15,00$
Mike Silva
Then, i just:
=ARRAYFORMULA(PROCV(USER&"|"&DATE;Team!B2:D;3;TRUE))
Thank you so much for your help!

each character has its own CHAR code:
so first we convert names into numbers:
=ARRAYFORMULA(SUBSTITUTE(FLATTEN(QUERY(TRANSPOSE(IFERROR(VLOOKUP(
SPLIT(REGEXREPLACE(A1:A4, "(?:)(.)", "$1 "), " "),
{CHAR(ROW(44:122)),SEQUENCE(79)}, 2, 0))),,9^9)), " ", ))
and next, we sum it and just add date and run approximate vlookup:
=ARRAYFORMULA(IFERROR(VLOOKUP(
MMULT(IFERROR(VLOOKUP(SPLIT(REGEXREPLACE(FILTER(D1:D, D1:D<>""),
"(?:)(.)", "$1×"), "×"), {CHAR(ROW(44:122)), SEQUENCE(79)}, 2, 0))*1,
SEQUENCE(MAX(LEN(D1:D)), 1, 1, 1))*A1:A, {
MMULT(IFERROR(VLOOKUP(SPLIT(REGEXREPLACE(FILTER(H2:H, H2:H<>""),
"(?:)(.)", "$1×"), "×"), {CHAR(ROW(44:122)), SEQUENCE(79)}, 2, 0))*1,
SEQUENCE(MAX(LEN(H2:H)), 1, 1, 1))*G2:G, I2:I}, 2, 1)))
update
or just:
=INDEX(VLOOKUP(D1:D&A1:A, SORT({H2:H&G2:G, I2:I}), 2, 1))

Related

How can I make correct formula for Age diff in Google sheet?

So, I wanted to claculate age from user birthdate to current date in Google sheet in my expected format. I tried few formula's from some sources, but it is just not happening.
Can anyone please guide me?
For reference and test purpose, I'm attaching one Google sheet public link. No worries if email address will be shown in Googe sheet.
Link: https://docs.google.com/spreadsheets/d/1jRlr6A3YRJIo1Ah1TSlRsDcLEDV_2BJ8YaBRS3YVC6Q/edit#gid=0
Assume birthday date is placed in range 'A2'.
Current age:
=DATEDIF(A2,TODAY(),"Y")&" year(s) "&DATEDIF(A2,TODAY(),"YM")&" month(s) "&DATEDIF(A2,TODAY(),"MD")&" day(s)"
you could use:
=INDEX(JOIN(" ",DATEDIF(A2, NOW(),
{"Y", "YM", "MD"})&{" year(s)", " month(s)", " day(s)"}))
but to make it "smart" (not show null values and use plural only when needed) try:
=INDEX(JOIN(" ", LAMBDA(a, LAMBDA(x, IF(x=0,,IF(x>1, x&a&"s", x&a)))
(DATEDIF(A2, NOW(), {"Y", "YM", "MD"})))({" year", " month", " day"})))
and for array it would be:
=INDEX(IF(ISDATE_STRICT(A2:A), TRIM(FLATTEN(QUERY(TRANSPOSE(
IFERROR(LAMBDA(a, LAMBDA(x, IF(x=0,,IF(x>1, x&a&"s", x&a)))
(DATEDIF(A2:A, NOW(), {"Y", "YM", "MD"})))({" year", " month", " day"}))),,9^9))), ))

GOOGLE SHEETS - how to automatically display cells horizontally

This is my first time posting and I hope someone can help.
I am not sure how to word this - here is my best go...
Please see example spreadsheet
Below I explain what I am trying to achieve that corresponds to the spreadsheet:
Clients pay a setup fee in a certain month - (B5)
I identify through a formula the month that the fee occurs - (C5).
There is a certain number of months (B7) after the fees start to roll out based on the fee schedule (Row 3)
4. DESIRED OUTCOME (Row 12) - I would like a formula that understands that the fee is paid in Month 3, then from Month 7 will roll out the start of the fee schedule from Row 3 (starting from Month 1, automatically)
Hope this all makes sense - please let me know if I can clarify anything and very much appreciate any help.
try:
=ARRAY_CONSTRAIN({SPLIT(REPT("0×", C5+B7-1), "×"), SEQUENCE(1, 12, 50, 10)}, 1, 12)

How to write latest record in Google Sheet formula and autofill?

I have a Google sheet - table 1 below and all the data is given. Table 1 data is people(VenderNo) claim that they want to join event with what data(EventStartDate) and what booth number(BoothNo). So the data is duplicated because people update it with new line and never allowd to delete or update the existing record(table 1).
Input data
And I also have a Google sheet - table 2 below and only EventStartDate and BoothNo are given. All I want to do is the result like table 2's VenderNo. The purpose of table 2 is trying to summarize which vendor is eventually joining the event with latest booth number.
Ideal result like blow:
Output data
May I know how to write this formula in table 2 column C (VendorNo) with autofill function like ={ "VendorNo"; unique(General!A2:A) } without hand dragging the formula?
Any thoughts and thank you.
P.S.: I am sorry I couldn't post image above directly because I don't have enough reputation.
Revision 1 for Mike Result: (Yellow highlight mismatched, since v001 should not join the same event date with 2 booths)
Revision 2 for Mike Result: (Yellow highlight mismatched, since v004 added to 2022-11-11 for BoothNo A01. BoothNo C01 doesn't erase as expected, Because same vendor(VendorNo) should only be with same date( EventStartDate) & latest booth selection(BoothNo))
Try
={"vendor";arrayformula(if(
iferror(vlookup(E2:E&"~"&F2:F,{B2:B&"~"&C2:C,A2:A,C2:C},3,0))
=
iferror(vlookup(vlookup(E2:E&"~"&F2:F,{B2:B&"~"&C2:C,A2:A},2,0)&"~"&E2:E,({unique({A2:A&"~"&B2:B}),(vlookup(unique({A2:A&"~"&B2:B}),SORT({A2:A&"~"&B2:B,C2:C,row(A2:A)},3,0),2,0))}),2,0),""),
iferror(vlookup(E2:E&"~"&F2:F,{B2:B&"~"&C2:C,A2:A},2,0)),""
))}
You don't need a Formula for that. Just select your columns and go to "Data" ->"Sort data"->"advanced sort settings" and then sort by column "EventStartDate" and secondly add sort by another column and add "BoothNo".
In the end you can run a data clean up to remove duplicates. You find it also under data.
to get the latest update from your table 1 you can use:
=SORTN(SORT(A2:C, B2:B, 0), 9^9, 2, 1, 1)
for your table 2 try:
={"VN"; INDEX(IFNA(VLOOKUP(E2:E&F2:F,
SORTN(SORT({B2:B&C2:C, A2:C}, B2:B, 0), 9^9, 2, 2, 1), 2, 0)))}

Google Spreadsheet SUMIF SUM

I need help. The employee has 10 hours per year at SICK, which are paid as working hours. I need help with formula. Example and more info are here:
https://docs.google.com/spreadsheets/d/1OfrNwIxavO89qN0HSZ6x_3hVi1MS1orFNv2VOd0OMx0/edit?usp=sharing
Try dividing the problem into smaller parts, like this:
cumulative sick hours: =sum(D$2:D2)
paid sick hours: =if( E2 < D$8; D2; max(0; D$8 - n(E1)) )
total: =sum(B2:C2; F2)
See the new Solution sheet in your sample spreadsheet.

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)

Resources