I have two sheets: one is input and the other is master.
A snapshot of my input sheet is shown below:
Workers Name WEEK working hrs
a11 w1 40
a22 w5 30
a33 w9 10
a44 w10 80
A snapshot of my master sheet is shown below (NB: the workers names are unique)
Workers Name W1 W2 W3 W4 W5 W6 W7 W8 W9 W10
a11 40
a22 30
a33 10
a44 80
I want a sumifs loop so that it can give result for workers working hrs in my masters table in their respective weeks(w1 to w13).
I am using a sum ifs formula for this:
Sheets("Master").Range("B2:B" & Range("A" & Rows.Count).End(xlUp).Row).Formula = "=SUMIFS(Input!C32,Input!C37,Master!C1,Input!C31,Master!B1)"
Any suggestions how to loop it in VBA
Please help....
I'm sorry but I'm not sure you need vba - if you know what your row and column criteria are in master you can write something like
=sumifs(workinghrs,workersname,$a2,week,b$2)
Then fill it down and across for your grid.
NB I've used named ranges for your input sheet for readability
Related
I've got a Google Sheets workbook with two sheets: Jobs
A
B
C
D
E
1
Turnaround
Received
Rate
Pages
Total
2
Standard
12/2/2021
$0.40
204
$81.60
3
Rush
12/9/2021
$0.60
79
$47.40
4
Rush
12/29/2021
$0.60
24
$14.40
5
Standard
1/1/2022
$0.45
81
$36.45
6
Standard
1/2/2022
$0.45
137
$61.65
7
Standard
1/5/2022
$0.45
95
$42.75
8
Standard
1/15/2022
$0.45
162
$72.90
Rates
A
B
C
D
1
Turnaround
Base Rate
Start Date
End Date
2
Standard
$0.40
9/1/2021
12/31/2021
3
Rush
$0.60
8/17/2018
6/10/2022
4
Expedited
$0.80
8/17/2018
6/10/2022
5
Daily
$1.00
8/17/2018
6/10/2022
6
Standard
$0.45
1/1/2022
6/10/2022
I'm trying to use an ARRAYFORMULA in Jobs!C1 to look up the value in Rates!B:B where the Turnaround in Jobs!A:A matches the Turnaround in Rates!A:A and the Date Received in Jobs!B:B falls on or between the Start Date in Rates!C:C and End Date in Rates!D:D.
The idea is that rates may change over time, but the job totals will still calculate using the correct rate at the time each job came in.
I know I can't use SUMIFS with ARRAYFORMULA, so I tried using QUERY, but this only populates the rate for the first job.
={"Rate";
ARRAYFORMULA(QUERY(Rates!A:D,
"select B where A contains '"&Jobs!A2:A
&"' and C < date'"&TEXT(Jobs!B2:B, "YYYY-MM-DD")
&"' and D > date'"&TEXT(Jobs!B2:B, "YYYY-MM-DD")&"'",0))}
I'm okay with adding helper columns if needed. I'm trying to avoid having to manually fill the formula down the column as jobs are added.
Here is a link to the workbook:
Job Rate Lookup By Turnaround + Date Range
I appreciate any help on this.
try:
={"Rate"; ARRAYFORMULA(IFNA(VLOOKUP(A2:A&B2:B, SORT({
FILTER(Rates!A2:A, Rates!A2:A<>"")&Rates!C2:C, Rates!B2:B}, Rates!C2:C, 1, Rates!A2:A, 1), 2, 1)))}
When using ARRAYFORMULA you won't be able to use QUERY in order to get the whole array of values as it will only return the first value that is found.
I created a formula that matches the value using VLOOKUP however I had to modify the name in Jobs from Standard to Standard 2.
This is the formula:
=IFERROR(ARRAYFORMULA(VLOOKUP(A2:A,Rates!A2:D6,2,0)))
These are the results:
I've been given a badly formatted sheet where there are thousands of records with X and corresponding Y value in the following row rather than the same row and next column.
Is there a function that will allow me to copy altering rows?
So...
A2 goes into B2 and A3 goes into C2
A4 goes into B3 and A5 goes into C3
etc
A sample sheet is in https://docs.google.com/spreadsheets/d/1fB2rpVdJiTmp96sjGZiIYvKxEL9DLiK7W7QU8-4AN3A/edit?usp=sharing
I'd prefer a Google Sheet solution but excel is fine as well.
delete everything in B2:C range and try:
={FILTER(A2:A, A2:A<>"", MOD(ROW(A2:A), 2)=0),
FILTER(A2:A, A2:A<>"", MOD(ROW(A2:A)+1, 2)=0)}
I'm having a hard time finding a way to add a second criterion to my array formula.
I have 3 columns that I'm tracking data from and I'm outputting this data onto a separate 'summary' tab.
Tab 1 has the following columns
B (quantity), C (employee name), and D (date)
Tab 2 has the following cells
A3 (daily total), B3 (weekly total), C3 (monthly total)
A7 (daily total for employee mark), A7 (weekly total for employee mark), C7 (monthly total for employee mark)
I created an array formula so that I could count all of the quantities added up over certain date ranges (daily, weekly, and monthly), but I also want to output this data and separate it by the employee also.
I can't for the life of me figure out a way to add this to my current formula or find another way to do it where it accurately can track the daily, weekly, and monthly sums of the quantity column.
I've attached a demo sheet so that you can see what I'm working with.
https://docs.google.com/spreadsheets/d/1iAS_U33lPCr-8xnmfK9WuL5URnK8ovY7V-TlKrrSKdQ/edit?usp=sharing
I really appreciate any help I can get on this.
try:
=ARRAYFORMULA(SUMIFS(Updating!B:B,
WEEKNUM(Updating!D:D), 47,
MONTH(Updating!D:D), 11,
YEAR(Updating!D:D), 2019,
Updating!C:C, "Santosh"))
and for Rina:
=ARRAYFORMULA(SUMIFS(Updating!B:B,
WEEKNUM(Updating!D:D), 47,
MONTH(Updating!D:D), 11,
YEAR(Updating!D:D), 2019,
Updating!C:C, "Rina"))
I am building a report in Google Data Studio, and I run into a problem with the aggregation for a couple of metrics.
As an example, I have the following table:
name. |. M1. |. M2. |. M3
A. 23 45 1,9
B. 45 6 0,1
C. 23 45 1,9
D. 12 34 2,8
E. 4 2 0,5
Where
M3 = M2/M1
Now, when I display this in a table in GDS, the totals for M1 and M2 are the sum of the values, and that is ok, but I can only choose between fixed aggregation operations, and the total for M3 should be:
Total M3 = sum(M2)/sum(M1)
Any idea if this is possible?
You can create your own custom field:
https://support.google.com/datastudio/answer/6299685?hl=en
I have the below array to detect 3 different criteria and return multiple results from a data source with 10000 Rows.
{=IF(INDEX(Inventory!$A$3:$Q$10000;SMALL(IF(($C$4=Inventory!$A$3:$A$10000)*($C$3=Inventory!$E$3:$E$10000)*(Inventory!$F$3:$F$10000="NEW");ROW(Inventory!$A$3:$A$10000)-ROW($C$3)+2);ROW(Inventory!1:1));16)=0;"";INDEX(Inventory!$A$3:$Q$10000;SMALL(IF(($C$4=Inventory!$A$3:$A$10000)*($C$3=Inventory!$E$3:$E$10000)*(Inventory!$F$3:$F$10000="NEW");ROW(Inventory!$A$3:$A$10000)-ROW($C$3)+2);ROW(Inventory!1:1));16))}
The Inventory table goes like this
A |E |F |P
Standard Laptop |Lisbon |NEW |XCVBMT
Engineering Laptop |London |DAMAGED |CVFTYU
Multiple Vendor |Madrid |QUARANTINE |CVBLPU
Standard Laptop |Lisbon |NEW |JKHGLK
I Have A and E criteria to select from drop down lists in C3 and C4.
If I delete the below criteria from the array, it works:
($C$4=Inventory!$A$3:$A$10000)
I cleared all formats, changed rows, changed the criteria to D4 and tiped in manually, trimmed... I think is right in front of me but have no clue on whats wrong.
I hope this is enough information.
Thanks