I realize this is an older thread, but it’s what I find when searching the forum on how to add the category type to the Transactions sheet. I couldn’t find if it’s still an issue to use a Type labelled column in the transactions sheet.
Anyhow, for anyone else searching/finding this thread who is starting from a new Foundation Template, here is what seems to work for me:
Check out this beauty. For consistency, it seems both would be done the same way, though this one is a bit more intimating =arrayformula(if(row($D$1:$D)=1,"Group",iferror(vlookup($D$1:$D,{indirect("Categories!$"&SUBSTITUTE(ADDRESS(1,MATCH("Category",Categories!$1:$1,0),4),1,"")&"$2:$"&SUBSTITUTE(ADDRESS(1,MATCH("Category",Categories!$1:$1,0),4),1,"")),indirect("Categories!$"&SUBSTITUTE(ADDRESS(1,MATCH("Group",Categories!$1:$1,0),4),1,"")&"$2:$"&SUBSTITUTE(ADDRESS(1,MATCH("Group",Categories!$1:$1,0),4),1,""))},2,FALSE),"")))
Your original works great but I think the static array approach is a little simpler for the header and XLOOKUP is a little easier to read than VLOOKUP and it better handles moving columns.
Note that a potential gotcha with using formulas like this in the Transactions Sheet occurs with copy-pasting Values-only workflows that modify these columns - then these columns will be blank besides the entries with pasted values. Normal copy-paste of rows within the Transaction Sheet will work though.
I’m finding that the XLOOKUP $D2 gets incremented to $D3 after using Add Manual Transaction. It continues to increment with every Add Manual Transaction. $D$2 doesn’t fix it. $D:$D also doesn’t. Then all the Category Types are incorrect.
That doesn’t happen and all is good with the original formula: =ARRAYFORMULA(IF($D:$D = "Category", "Category Type", IFERROR(VLOOKUP($D:$D,Categories!$A$2:$C,3,FALSE),"")))
@randy I’m finding that when using your tweaked version of the formula, adding INDIRECT to put the cell reference inside a string, prevents the formula’s cell reference incrementing after using Add Manual Transaction.
I just tried this code for adding the group and it seemed to work fine, even after doing a manual transaction: ={"Group";IFERROR(BYROW($D$3:$D,LAMBDA(category,XLOOKUP(category,Categories!$A$2:$A,Categories!$B2:$B))),"")}
Ahh, I get what you’re saying now, and you’re right, I didn’t notice the groups and categories weren’t aligned properly anymore. I switched the formula to use an INDIRECT as you suggested and it does then work as expected: ={"Group";IFERROR(BYROW(INDIRECT("$D2:$D"),LAMBDA(category,XLOOKUP(category,Categories!$A$2:$A,Categories!$B2:$B))),"")}
Yep! And for fun, insert a row at the top of your Category sheet to see your Category sheet variables in your formula change in the same way.
I understand inserting rows in the Category sheet causes data validation issues, likely for similar reasons, and shouldn’t be done … but, it just shows the interaction. It’s a feature