Created
December 28, 2023 19:25
-
-
Save ncalm/6d8018ed048e5b43f8ad2ab7c909b5c5 to your computer and use it in GitHub Desktop.
This Excel LAMBDA function allows pivoting of attribute/value stacks where some entities have missing attributes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PIVOTEVERYNROWS = LAMBDA(attribute, value, first_attribute, | |
LET( | |
unique_attributes, UNIQUE(attribute), | |
attribute_ids, SEQUENCE(ROWS(unique_attributes)), | |
col_id, XLOOKUP(attribute, unique_attributes, attribute_ids), | |
shift, --(attribute = first_attribute), | |
row_id, SCAN(, shift, SUM), | |
pivoted, PIVOTBY(row_id, HSTACK(col_id, attribute), value, SINGLE,0,0,,0), | |
DROP(pivoted, 1, 1) | |
) | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
={"Attribute","Value";"Project Code","CAPX001";"Department","IT";"Vendor","HighTech Solutions Inc.";"Budgeted Amount",100000;"Actual Spend",120000;"Variance",-20000;"Project Manager","John Doe";"Approval Status","Approved";"Capitalization Date",44941;"Asset Class","IT Equipment";"Location","New York";"Useful Life","5 years";"Residual Value",10000;"Project Code","CAPX002";"Department","Facilities";"Budgeted Amount",80000;"Actual Spend",85000;"Variance",-5000;"Project Manager","Jane Smith";"Approval Status","Pending";"Capitalization Date",44986;"Asset Class","Electrical Systems";"Location","Chicago";"Useful Life","10 years";"Residual Value",8000;"Project Code","CAPX003";"Department","Construction";"Vendor","Global Constructors Ltd.";"Budgeted Amount",450000;"Actual Spend",500000;"Variance",-50000;"Capitalization Date",44967;"Asset Class","Real Estate";"Location","Houston";"Useful Life","30 years";"Residual Value",50000;"Project Code","CAPX004";"Department","Software";"Vendor","Innovative Software LLC";"Budgeted Amount",180000;"Actual Spend",200000;"Variance",-20000;"Project Manager","Anna Brown";"Approval Status","Approved";"Capitalization Date",45036;"Location","Seattle";"Useful Life","3 years";"Residual Value",0;"Project Code","CAPX005";"Department","Logistics";"Vendor","Fleet Motors Inc.";"Budgeted Amount",280000;"Actual Spend",300000;"Variance",-20000;"Project Manager","Tom Wilson";"Approval Status","Pending";"Capitalization Date",45092;"Asset Class","Vehicles";"Location","Miami";"Useful Life","8 years";"Residual Value",30000;"Project Code","CAPX006";"Department","Energy";"Vendor","Efficient Energy Solutions";"Budgeted Amount",140000;"Actual Spend",150000;"Variance",-10000;"Project Manager","Lisa Green";"Approval Status","Approved";"Capitalization Date",45129;"Asset Class","Energy Systems";"Location","San Diego"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment