If Function isn't working properly - function

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

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)))

Is there a function that saves the last value inputted with query?

=IF(Summary!H2="October",QUERY(Summary!L2))
Hello,
I was wondering if it’s possible to record the last inputted value with a query function
As seen in the code above, when October is selected in the summary sheet, cell H2 - the cell with the function (above) outputs what is written in the summary sheet, cell L2
When I select a different month, the cell (where the code is written) changes to FALSE
Is there any way to make value_if_false equal the last value inputted into L2 when the selected month is changed?
If further proof is needed please let me know
Thank you,
Gabe
example
Don't know if this is what you mean, here I have created an example, where data is stored in the 'data' sheet, and the QUERY function is placed in the 'main' sheet.
B1, B2 is the condition inputs, I assume you want to sort your data by date, in that case, you will need a start day and an end day.
the QUERY formula will be something like this:
=QUERY({data!A:F},
" WHERE Col1 IS NOT NULL "
&" AND Col1 >= DATE '"&TEXT($B$1,"yyyy-mm-dd")&"' "
&" AND Col1 <= DATE '"&TEXT($B$2,"yyyy-mm-dd")&"' "
)
With this QUERY formula, the output data will change according to the date selected in B1 and B2.
Just make sure that the date column of your data page is formatted as date, otherwise google sheet QUERY will not be able to recognize the data as date.
link of the sample spreadsheet

Google Sheets: Conditional formatting in an array based on source column of separate sheet

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.

Count the values from a variable column

I have a problem writing down a formula or a script in Google Sheet or Google App Script to find and count the values in a sheet where the number and references to the columns change.
I have a script that copy&paste the Sheet files for the staff shifts of every week from a Drive folder and merge them side by side (in horizontal).
In this sheet that contains all the shifts merged I want to count all the cells of the staff filtered only for handler and picker (column B, K, etc.) according to a specific date (row 3) for every hour.
Example: if today is 28/10/2020 find the right column with the same date in row 3 --> column E, count all the values from row 4 filtered by picker or handler for every hour (10 people at 05 AM).
Do you think that I can implement this with a formula (like a matrix, vlookup, etc.) or should it be written as a Script?
Thank you very much,
Marco
Please use the following
=COUNTA(QUERY({A3:I;J3:R},"select Col"&MATCH(A1,A3:I3)&"
where Col2 matches 'Technician|Picker' "))
Where B1 holds the date you wish to search for (28/10/2010)
Try the below formula. Replace date with your search date.
=COUNTA(INDEX(A4:R14,,MATCH(DATE(2020,10,28),A3:R3)))
This was earlier tagged as excel. This is how to "tackle" this in excel (office 365):
In a clear column use the following formula to get the unique hour-values that are in the column that equal today:
=UNIQUE(FILTER(INDEX(($4:$1048576,,MATCH(TODAY(),$3:$3,0)),INDEX(($4:$1048576,,MATCH(TODAY(),$3:$3,0))<>""))
In the column next to that type the following to get the result of the count of those unique values for that day:
=COUNTIF(INDEX(($4:$1048576,,MATCH(TODAY(),$3:$3,0)), FILTER (I:I,I:I<>""))
Where I:I in FILTER (I:I,I:I<>"") needs to be changed into the column you put the first formula.

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)