i'm trying to create "chart of accounts" for a small accounting project , to generate accounts numbers based on accounts names ,
i already tried sheet's formulas but it isn't ideal since i'm using a form to add new accounts and it will be unsorted ,
i want to convert all formulas into arrayformulas to make it dynamic but i couldn't manage to solve that without getting slower calculation time ,
here is a:
copy of my sheet
I understand that you are looking for a better formula in 'Parent' and 'Account', right?
For 'Parent' i suggest SWITCH formula that is useful for many conditions. It also provides default value when no conditions are met.
I also use array_constrain formula that limits arrayformula to filled rows only (checks whether F column has some content).
Try in L2:
=array_constrain(
ArrayFormula(switch(K2:K,
2,F2:F&"|0|00|000|0000",
3,F2:F&"|"&G2:G&"|00|000|0000",
4,F2:F&"|"&G2:G&"|0"&H2:H&"|000|0000",
5,F2:F&"|"&G2:G&"|0"&H2:H&"|00"&I2:I&"|0000",
"0|0|00|000|0000")),
Count(F2:F),1)
'Account' column is easier as there are no conditions:
Try:
=array_constrain(
ArrayFormula(
TEXT(F2:F,"0")&"|"&TEXT(G2:G,"0")&"|"&TEXT(H2:H,"00")&"|"&TEXT(I2:I,"000")&"|"&TEXT(J2:J,"0000")
),Count(F2:F),1)
Here I also limit arrayformula to unempty rows using array_constrain.
Related
Having an issue figuring out a proper Google sheets formula that works
This is my reference sheet
=SUM(IF(AND('Online Arbitrage'!A:A = D5, 'Online Arbitrage'!M:M >=DATE(A2,1,1), 'Online Arbitrage'!M:M <=DATE(A2,12,31), 'Online Arbitrage'!N:N> 0),'Online Arbitrage'!H:H*'Online Arbitrage'!N:N))
I tried this formula in the "Taxes" worksheet and other variants with no success.
I am needing it to pull through the total purchases per supplier from the "Online Arbitrage" sheet based on the year that I have entered into A2.
In this example, I am expecting a result of $2,696.04 and it is producing a result of $0. I've tried other variations of this formula and it produced a result of around $5,700 which was also incorrect.
Try:
=sumproduct(('Online Arbitrage'!$A$4:$A=D5)*('Online Arbitrage'!$M$4:$M>=DATE(A2,1,1))*('Online Arbitrage'!$M$4:$M<=DATE(A2,12,31))*('Online Arbitrage'!$N$4:$N>0)*'Online Arbitrage'!$H$4:$H*'Online Arbitrage'!$N$4:$N)
You generally can't use AND/OR statements in arrays as they aggregate so won't give you the expected result. Instead, use * instead of AND and + instead of OR. I've also limited your ranges to avoid the header cells.
I have a google sheet with multiple tabs, one of the tabs is for holding each observation of data while another needs to combine data based on certain criteria. I am trying to use a SUMIFS within and ARRAYFORMULA to get the correct information and it will only pull "0" no matter what I try.
I have set up a test google sheet with some dummy information to show an example of what I need to do in a more complex situation.
https://docs.google.com/spreadsheets/d/1JLyEuVijQ8MvfOKrtbRD_YKmRDnTCxf7qCSw9Ggty_Y/edit#gid=1250575550
In this example, the data tab is the individual observations and the sums tab is where I'm trying to pull combinations. I need column D to sum the totals in column E on the data tab if the Month and Year and Type all match what is on the sums sheet. In this example, cell D3 on the sums tab should equal 11.
you cannot use SUMIFS() in Arrayformula(), along with many other functions, though there is no formal documented list.
In your case you can use a SUMIF() instead by &'ing the condtions together.
I've demoed the concept on a new tab called MK_Help in cell D2:
=ARRAYFORMULA(IF(ROW(A2:A) = ROW(A2), "# TOTAL TYPE", IF(A2:A = "", , SUMIF(data!A:A&data!B:B&data!C:C,A2:A&B2:B&C2:C,data!E:E))))
Note that I made a couple of other small changes to your formula.
Namely, that you should always use a true "empty" instead of double quotes in your IF() mask up front tor return empty when there's no value in A. Double quotes("") is actually not quite empty for many other things in Google sheets.
Also I modified your header conndition from ROW(A2:A)=2 to ROW(A2:A) = ROW(A2). I find that this is a more flexible condition for the header as it allows you to potentially insert/delete rows above the header without breaking things.
It seems QUERY() may be good choice. Try-
=QUERY(data!A2:E,"select A,B,C, sum(E) where A is not null group by A,B,C",1)
If you need specific month then you can add criteria to where clause like-
=QUERY(data!A2:E,"select A,B,C, sum(E) where A =5 group by A,B,C",1)
I have two tabs in a sheet, that have different ranges. One is preset data, the other is an import from a program we use. I'm trying to figure out a way, if possible, to pull specific data from sheet 1, and match it with values in sheet two, that aren't sorted the same.
Example sheet
https://docs.google.com/spreadsheets/d/1OsSWQ_48VrcTU3pXGeJ_1syluKPVeVRune39UA9I3x4/edit?usp=sharing
I'm trying the formula =sort(filter(Sheet1!B1:B,match(B1:B, Sheet1!B1:B ,0)),2,TRUE), but it's just putting the results in order. If I replace the column # on the sort with 1, it sorts it out of order but it doesn't match column B, like I need it to.
The documents i'm working with are 2000+ rows each, I'd rather not manually do this if at all possible.
Please assist? Either way, thank you for reading.
Try:
=arrayformula(iferror(vlookup(MATCH( B1:B,Sheet1!$B$1:B,0),{(ROW(Sheet1!A1:A)),Sheet1!A1:A},2,0)))
Explanation
step#1 =arrayformula(MATCH( B1:B,Sheet1!$B$1:B,0)) will give the row where each value column B will be found in Sheet1!column B
step #2 =arrayformula({ROW(Sheet1!A1:A),Sheet1!A1:A}) will build a virtual matrix whith in column#1 the row and in column#2 the value of Sheet1!column A
finally: join the two formulas as vlookup(___step#1____,____step#2______)
Sounded so simple! I have a sheet called "Account", containing a running balance in column "G" and I have another sheet called "Performance", with a table which lists historical dates and column "D" needs to lookup the account balance on the day stated in column "A".
"Account" Sheet
"Performance" Sheet
For example, Performance!D2 should be "210,000.00".
Performance!D7 should be "110,000.00".
Performance!D9 would be "40,000.00".
To make this slightly more difficult I like to put formulas into the heading row as arrayformulas where possible, to avoid problems when copying and pasting data or adding new rows, etc.
I've tried many different possibilities and nothing has worked. I'm currently trying to make the following formula work, which is in Performance!D1.
=ARRAYFORMULA(if(row(D1:D) = 1, "Cash", VLOOKUP(A1:A, MIN('Balance'!A4:A <= A1:A), 7, 1)))
I've also tried some solutions involving MATCH(), FILTER(), VLOOKUP() and LOOKUP() but so far no cookie!
this should work:
=ARRAYFORMULA({"Cash";if(A2:A="",,VLOOKUP(A2:A, SORT('Account'!A4:G),7,TRUE))})
VLOOKUP(...,true) returns the value associated with the closest match in the first column without going over. Provided that the range into which you're doing the vlookup is sorted by the first column of that range.
My problem, generally stated:
I need a formula that returns all the values in a specific column for which multiple criteria in other columns of the respective row apply.
My problem, specifically stated:
I would like a formula that returns all the values in Column A for which Column C is "John", Column E is "Apples", Column G is "Earth" and both Columns H and I are empty. See here for a simplified illustration of my problem with dummy data. The correct formula, dragged down, would output a list with the values "1", "4", and "14". If you'd like to try out some stuff in the linked spreadsheet, feel free to do so in a copy of the original sheet so others can see my original data/formulas.
What I've tried so far:
Simply filtering was not an option because the data is on a separate sheet within the same spreadsheet. I also knew VLOOKUP and INDEX/MATCH were not going to do what I wanted - VLOOKUP doesn't handle multiple criteria, and while the MATCH part of INDEX/MATCH can be turned into an array to specify multiple criteria, it only returns the first value for which all conditions are true, while I need all of them.
I then tried the following formula (Formula 1 in the linked spreadsheet):
=IFERROR(INDEX($A$2:$I, SMALL(IF(COUNTIF($K$2, $C$2:$C)*COUNTIF($K$3, $E$2:$E)*COUNTIF($K$4, $G$2:$G), ROW($A$2:$I)-MIN(ROW($A$2:$I))+1), ROW(A1)), COLUMN(A1)),"")
It worked like a charm, until I wanted to include the condition that both columns H and I should be empty. I tried this, but for some reason I don't understand it didn't work (Formula 2 in the linked spreadsheet):
=IFERROR(INDEX($A$2:$I, SMALL(IF(COUNTIF($K$2, $C$2:$C)*COUNTIF($K$3, $E$2:$E)*COUNTIF($K$4, $G$2:$G)*COUNTIF($K$5, $H$2:$H)*COUNTIF($K$6, $I$2:$I), ROW($A$2:$I)-MIN(ROW($A$2:$I))+1), ROW(A1)), COLUMN(A1)),"")
Then I tried to nest my first formula into an IF/VLOOKUP (Formula 3 in the linked spreadsheet):
=IFERROR(IF(VLOOKUP(INDEX($A$2:$I, SMALL(IF(COUNTIF($K$2, $C$2:$C)*COUNTIF($K$3, $E$2:$E)*COUNTIF($K$4, $G$2:$G), ROW($A$2:$I)-MIN(ROW($A$2:$I))+1), ROW(A1)), COLUMN(A1)),$A$2:I,8,FALSE)<>"","",INDEX($A$2:$I, SMALL(IF(COUNTIF($K$2, $C$2:$C)*COUNTIF($K$3, $E$2:$E)*COUNTIF($K$4, $G$2:$G), ROW($A$2:$I)-MIN(ROW($A$2:$I))+1), ROW(A1)), COLUMN(A1))),"")
This worked if I only asked for column H to be empty, but a) it is very unwieldy, b) it gives you blanks in the list it returns, which I do not want, and c) I could not get it to work for the condition that both columns H and I need to be empty using OR.
That's where I'm stuck, and I haven't come up with a good solution. Knowing this forum, I'm sure someone has an elegant solution I was not smart enough to find :)
I'm on phone so formating will suffer.
Create a new column on the left and insert the following into cell A2
=if(D2="John", if(F2="Apples", if(H2="Earth", if(I2="", if(J2="", B2,""), "" ), "" ), "" ), "")