I have a spreadsheet that I want to calculate the average of the first three values in a row...
For example:
Column A Column B Column C Column D
Row 1 7/1/2017 6/1/2017 5/1/2017
Row 2 $934 $392 $214
So my formula is
=average($A$2:$C$2)
This works fine, until I add a new column to the left of Column A to add the newest month's data which now looks like this:
Column A Column B Column C Column D
Row 1 7/1/2017 6/1/2017 5/1/2017
Row 2 $934 $392 $214
The issue is that spreadsheet automatically changes the formula to
=average($B$2:$D$2)
when what I really want is to retain the original formula so it will continue to give the the average of the most recent three months of data.
Here is a link to a spreadsheet so you can see what is happening, sheet one is before added column, and sheet two is after adding column.
https://docs.google.com/spreadsheets/d/1XE2zyFGCHUfSf44vNHwXij59I68LJEL_L7cNSf0-uag/edit?usp=sharing
How can I do this? Thanks!
I suggest a sensible place to put such a formula is in ColumnA (having made room for it!) hence:
=average(OFFSET(A2,,1,1,3))
Related
I'm trying to work out a function in a Google Sheets cells to look at a column then search current row and "above" the current row to find a non number value (text).
I have data that in two columns B (item code or category) & C (item description).
I need another column to contain the categories for each item - column D. I'm looking for a formula for this column, ideally an Arrayformula as the data can change, there can be multiple items per category, some might be only 1 item, some might be 100 items per category. The arrayformula in column D will get the category from column B if it is not a number.
B column - categories and item codes, C column - item descriptions, target is D column a copy of the categories from column B.
I've tried this numerous times and usually give up, do it manually but it becomes teadious quickly. Looking forward to any help that might come from this! thanks.
In D2 try
=Arrayformula(if(isnumber(B2:B), vlookup(row(B2:B), filter({row(B2:B) , B2:B}, istext(B2:B)), 2), B2:B))
and see if that works?
Try in D1
={"Category";ArrayFormula(lookup(row(B2:B),row(B2:B)/if(isnumber(B2:B),0,1),B2:B))}
I need an array formula only in column Date_2 with results like on screenshot and that will
insert last day of month depending on Date_0 (if bunch of Color&Fruit&Meal doesn't repeat in table)
insert first minimum date of column Date_1 (if bunch of Color&Fruit&Meal repeats first time) - 1
insert second minimum date of column Date_1 (if bunch of Color&Fruit&Meal repeats second time) - 1
and so on...
Is is possible to solve it with array formula?
I've tried but I can't..
=ArrayFormula(IF(A2:A="","",IF(COUNTIF(B2:B&C2:C&D2:D,B2:B&C2:C&D2:D)>1,INDEX(FILTER(B2:E,E2:E<>""),1,4),EOMONTH(A2:A,0))))
Google Sheets
I'm not quite sure what you need for Date_1 but try this arrayformula in cell F2 for Date_2:
=ARRAYFORMULA({"Date_2";if(IF(B2:B&""&C2:C&""&D2:D<>"",if(A2:A<>"",COUNTIFS(B2:B&"|"&C2:C&"|"&D2:D,B2:B&"|"&C2:C&"|"&D2:D,ROW(A2:A),"<="&ROW(A2:A)),),)=1,eomonth(A2:A,0),)})
I've added a duplicate sheet ("Erik Help") with the following formula in F1:
=ArrayFormula({"Date_2";IF(A2:A="",,IFERROR(VLOOKUP(B2:B&C2:C&D2:D&TEXT(COUNTIFS(B2:B&C2:C&D2:D,B2:B&C2:C&D2:D,ROW(A2:A),"<="&ROW(A2:A))+1,"000"),{B2:B&C2:C&D2:D&TEXT(COUNTIFS(B2:B&C2:C&D2:D,B2:B&C2:C&D2:D,ROW(A2:A),"<="&ROW(A2:A)),"000"),E2:E},2,FALSE)-1,EOMONTH(A2:A,0)))})
This formula creates the header (which you can change within the formula) and all results for Column F.
To lookup the "next instance of the group if there is one," I just wrote the formula to VLOOKUP that grouping plus a text rendering of the COUNTIFS-as-of-that-row-plus-1 for that grouping within a virtual array of each-grouping-plus-unique-count-thus-far in one column and the E2:E data in the next column. For instance, for Row 2, the formula VLOOKUPs redapplepie002
(002 being the text rendition of 001, which is the count of redapplepie as of row 2).
So I am using a conditional formatting custom formula to highlight a cell if the column it is summing from another spreadsheet has blanks, but I don't know how to do it with changing ranges. Basically what I want to do is use a third column, say column A, to determine the length of the range (of rows) I want to scan with CountBlank, and if it picks up a blank in there to return a "True".
So basically:
Column A Column B Column C Column D
Person 1 5:30AM 3:00PM 9.5
Person 2 5:00AM 8
Person 3 4:30AM 4:00PM 10.5
So ideally, the cell sums the fourth column with a different function (already have that), and it conditionally formats itself if a blank is picked up in Columns B or C, going all the way down to the last row of column A that has a value. Any help here would be appreciated, thank you.
If I understand you correctly, the custom formula for conditional formatting should be:
=or(countifs(A2:A,"<>",B2:B,""),countifs(A2:A,"<>",C2:C,""))
Suppose you had a list of people's names starting in F2 and their total hours starting in G2. Then you could alter the formula to:
=or(countifs(A$2:A,F2,B$2:B,""),countifs(A$2:A,F2,C$2:C,""))
Some week ago, an array formula I use in Google Sheets stopped working correctly:
=arrayformula(if(row(A:A)=1,"Convert Type",if(len(A:A)=0,iferror(1/0),iferror(vlookup(C:C,'Sheet2'!$A$2:$B,2,FALSE),"Error"))))
This formula is in Sheet1 column B1, in the frozen first row. What it is supposed to do is to take the values from Sheet1 column C, compare the values from Sheet2 column A, and insert the values in Sheet1 column B for those corresponding in Sheet2 column B (from Type1 to Type2). If there is a mismatch between the possibilities in Sheet2 column A and Sheet1 column C, the new value in Sheet1 column B will be 'Error.' The formula stops when there is nothing in Sheet1 column A (Timestamp).
Now, for some reason, all the values in Sheet1 column B are set to 'Error.' Something similar happened before when Google made a back-end update, but this time I can't figure out what I am supposed to change. Any ideas?
Example Sheet
Edit: made the text clearer and added a link with example.
Just adding a extra space in your formula updates the formula to correct values and I'm unable to find the source of the error.
Regardless, the formula was unnecessarily complicated and I simplified it a bit to it's core bone version. Try this instead:
=ARRAYFORMULA({"Convert Type";VLOOKUP(C2:INDEX(C:C,COUNTA(C:C)),Sheet2!A:B,2,0)})
I'm trying to accomplish a lot with little knowledge, but I have a spreedsheet with data that i want to convert into something readable that I can then display on my website.
Anyways, in column A I have a list of dates, column B a list of names, and column c a list of contributions. What I would like to do is first total the amount of contributions in C, for a date range in A.
I would then like to find all the duplicates in Column B(repeat donors), and total their contributions in C.
There is a VBA, that I found on here that would accomplish the second task, but ... I'm using Google Sheets. What I've been doing is sorting the sheet and totalling everything manually.
What I would like to do is first total the amount of contributions in
C, for a date range in A.
Use SUMIF
I would then like to find all the duplicates in Column B(repeat
donors), and total their contributions in C.
Assuming you have 100 records, starting from 1st row for below code.
In cell D1, put =UNIQUE(B1:B10), it will fill D column with unique values of given range (B1:B100).
In cell E1, put =SUMIF(B$1:B$100,D1,C$1:C$100)
Repeat same formula in E column