Google Sheets: Conditional formatting in an array based on source column of separate sheet - google-apps-script

I have a sheet named Equipment with two columns G "Purchased Date" and H "Installation Date". A separate sheet named December is a calendar that is populated with data from Equipment when the dates match.
In the example below, I3 in December is 12/01/2020
=ARRAYFORMULA(IFERROR(INDEX(Equipment!A2:D,SMALL(IF(I3=Equipment!G2:H,ROW(Equipment!G2:H)-1),1))))
I would like to indicate in December that the data is a "Purchase Date" or an "Installation Date", preferably through conditional formatting (One is red font the other is blue font). The only solution I can think of is to force user to have two separate rows, one for "Purchase Date" and one for "Installation Date". Is it possible to avoid doing this?
Equipment
December

I came up with an answer that you may want to try. But it does involve a helper column for each day of the week. See my sample sheet here. I've used columns AS to AW on the far right for this. In AS, I put this formula:
=ArrayFormula(COUNTIFS(Equipment!$A$2:$A,D5:D,Equipment!$G$2:$G,$D$3))
This does a COUNTIFS in the Equipment tab for records that have the same Project Name as this row, and a purchase date equal to the date for this day of the calendar. This returns a 1 or a 0.
Then conditional formating rules are used to change the Project Name (in column D) to red text if column AS=1 (a purchase date), or blue text if not. If you predefined all of the text in this column as red (or blue) you would only need one CF rule for the whole column, making this easier to set up. You already have CF rules for your date headers, so they could override the default font colour (red or blue) assigned to the column, without needing an additional rule.
Note also that I found an alternative to your formula in D5 (and I5, N5...):
=iferror(query(Equipment!$A$2:$I,"Select A,B,C,D
where (G = date '"& text(D3,"yyyy-mm-dd") & "'
or I = date '"& text(D3,"yyyy-mm-dd") & "') order by A",0))
This returns all of the results for this day, with one formula.

Related

How to apply array formula to join all the cells in a column and exclude empty cells in google sheets doc spreadsheet

=ArrayFormula(join(",",char(34)&E3:E11&char(34))) This is the formula I have thus far.
It is able to output the values from the ranges I have manually chosen E3 to E11 which are
Nurse
Nurse Practitioner
Physician Assistant
Dialysis
Nurse Anesthetist
Dental Hygienist
Lab Technician
Diagnostic Technician
Medical Records
The formula is able to output them like this:
"Nurse","Nurse Practitioner","Physician Assistant","Dialysis","Nurse Anesthetist","Dental Hygienist","Lab Technician","Diagnostic Technician","Medical Records"
I would like to be able to make the range E3:E so that new values will be automatically outputted when they are added in. But, doing this with the formula I have now just includes a bunch of trailing empty quote values, like this "" because of the blank cells.
How can I exclude blank cells from applying to my ArrayFormula?
try:
=INDEX(JOIN(",",CHAR(34)&FILTER(E3:E,E3:E<>"")&CHAR(34)))

libreoffice calc lookup: return value if date is between two dates

I have a list (csv) of payments (and their timestamps) from certain phone numbers and a separate list (also csv) of subscriptions, plus start and end dates of the subscriptions for said phone numbers.
However, several phone numbers have had 2 subscriptions historically (ie. started one, stopped it, started a new one) and I need to associate each payment with the right subscription.
Essentially, I need a way to do
"FOR
this payment RETURN the subscription.id WHERE subscription.phonenumber=payment.phonenumber AND payment.timestamp IS BETWEEN sub.startdate AND sub.enddate".
How can I accomplish this with a formula? For those that only had a single subscription, I just did INDEX MATCH, however I can't see that working here
Let's say you put 2018-01-01 to A1 and 2018-12-31 to A2. Then the date to be tested (e.g. 2018-06-01) to A3. Put =IF(AND(A3>A$1;A3<A$2);"True";"False") to e.g. B3, this will give True. If you put 2019-06-01 to A3, it'll give you False.

search range of alternating date and payment cells

Search a huge range
I have a huge range (O15:BJ9309) that contains alternating cells of dates and payments in each row (date, payment, date, payment, date, payment, etc.) I need a formula that looks for dates that contain a specific year (ex. 2014) and adds up all payments to the immediate right of that date.
For example, in the range:
Date..............Pymt.......Date..........Pymt.....Date.........Pymt
12/18/2013....$400.....1/2/2014....$750.....2/1/2014...$320
In the above example, it would add $750 + $320 because both payments were made in 2014, but ignore a $400 payment made in 2013.
I’ll insert this formula in a hidden table, adjusting it to search for subsequent years:
Tax Year.....Gross
2014...........$80,000
2015...........$75,000
2016...........$93,000
Once that’s in place, I want to insert two cells into my Date and Payment’s page header, one labeled “Tax Year” and the second “Gross.” If “2015” is typed into the Tax Year cell, “$75,000 displays in the Gross cell. So I need a formula for that, too.
Many Thanks!
Given that your first column is "odd" (#15), you can try this array formula:
=SUM(IF(MOD(COLUMN(Rng),2)*(YEAR(Rng)=2014),OFFSET(Rng,0,1)))
Rng Refers to: $O$15:$BJ$9309
To array-enter a formula, after entering
the formula into the cell or formula bar, hold down
ctrl-shift while hitting enter. If you did this
correctly, Excel will place braces {...} around the formula.
Edit: If you replace the 2014 with a cell reference, you can vary the output easily according to the year of interest.
Do you have headers like those shown in row 14?
If so try using SUMPRODUCT like this
=SUMPRODUCT((O14:BI14="Date")*(YEAR(O15:BI9309)=2014),P15:BJ9309)

If Function isn't working properly

I'm trying to pull out only Salary Earnings from a Payroll tab to "Salary Earnings" column on Unique payroll tab using this "IF" function: =IF(Payroll!F2="Salary", Payroll!G2, " ") but for some reason it's skipping the salary on the same date as bonus.
I even tried the below one, and it's leaving D5, D6, and D7 empty.
=IF(AND(Payroll!F2="Salary", Payroll!C2=UniquePayPeriod!C2), Payroll!G2, " ")
Can anyone help please?
Thanks!
If I assume you're dragging the formula down in your UniquePayPeriod spreadsheet, then you may not be getting the "right" output, but you're getting the "accurate" output.
D5 will be blank because F5 is "Bonus", failing your if condition
D6 will be blank because Payroll!C6 is not equal to UniquePayPeriod!C6
D7 will be blank because Payroll!C7 is not equal to UniquePayPeriod!C7
This is happening because your Payroll sheet is listing Bonuses on separate line items with the same dates; after the first listing of a bonus, your Check Dates on your UniquePayPeriod sheet will not align with your Check Dates on the Payroll sheet
What you'll need to do is use Match and Index to look up the condition of ID, Check Date, and Salary, and then ID, Check Date, and Bonus.
This is the formula you need to put in your Salary Earnings Column
=IFERROR(INDEX(yourPayrollTable,MATCH(B2&C2&"Salary",yourIDColumn &
yourCheckDateColumn & yourEarnTypeColumn,0),7),"")
This is the formula you need to put in your Salary Earnings Column
=IFERROR(INDEX(yourPayrollTable,MATCH(B2&C2&"Bonus",yourIDColumn &
yourCheckDateColumn & yourEarnTypeColumn,0),7),"")
yourPayrollTable should be the range of data on the Payroll sheet
that has all your payroll information (Payroll!A2:G100 for example)
yourIDColumn should be the range of data on the Payroll sheet
that has all the IDs (Payroll!A2:A100 for example)
yourCheckDateColumn should be the range of data on the Payroll sheet
that has all the Check Dates (Payroll!C2:C100 for example)
yourEarnTypeColumn should be the range of data on the Payroll sheet
that has all the Earn Types (Payroll!F2:F100 for example)
These formulas are Array Formulas, so please make sure you press Ctrl+Shift+Enter after entering the formula and dragging it down, instead of just pressing Enter.
This can be a bit confusing so please comment if it does not make sense what you need to do

How to add a function referencing another column to libreoffice-calc?

Sorry for the simple question, I was expecting this to be a 2 minute job but it has proved much trickier to figure out than I planned, and the 'Function Wizard' has been no help.
I have a spreadsheet of products (one row = one product, columns = product name | stock | RRP etc).
Column D gives cost price excluding vat, I need to add another column giving cost including vat ( column D + 20% ).
I've figured out how to add functions to, and reference specific cels, so I can do it on a cel by cel basis =SUM(D2*(1.2)) but for obvious reasons, I'd rather do this once for the column instead of doing 10k+ products one by one! What am I missing?
The "Fill Down" feature may be useful in your case:
Select the first cell holding your formula and all the cells down your sheet where the formula should get inserted;
Select Menu "Edit" -> "Fill" -> "Down", or hit CTRL+D
This will make Calc to copy the formula into all selected cells, updating the cell references (except if you have absolute references using the dollar sign).
For 10k+ rows, this may take a short time, since Calc will calculate the results, too, but it should work at least.