Formulas and Functions
25101 Topics- 30Views0likes1Comment
Excel: Count cells with specific value + colour
Hi there, I would like to be able to count the number of cells that contain a specific value and are shaded a specific colour. This is for a rota spreadsheet that will be tallying the total number of shifts which have been agreed. The cells that contain "Yes" as a value from a drop down list and are shaded green, should be counted as part of the quarterly total. I'm assuming that a VBA custom function would be needed for this. I've tried a few but cannot figure out a way to get this to work with both a specific value and colour. I would be very grateful for anyone that is able crack this challenge. In the example screenshots, it is the cells shaded in green that would need to be counted and the totals appear in column GJ. Best regards, Daniel200Views0likes7CommentsThe Diagonal Suite: Gentle thunking goes a long way!
I've become a big advocate for gentle thunking - using thunks to delay eager evaluation wherever possible in generalized Lambda development. The timings are quicker and the logic is cleaner. On the other hand, thunking the results of MAP, BYROW, or BYCOL - especially when it leads to rows of thunks - tends to introduce recombination overhead and complexity. I think thunking is often dismissed as “too complex,” and that’s understandable if someone’s first exposure involves unwrapping a row of thunks. When used gently thunking becomes indispensable. Typically, I introduce the thunks after the initial benchmarking to see the difference in the calculation times and the after is always quicker. To illustrate, I’ll share The Diagonal Suite - a collection of functions where thunking is used at every opportunity. Simple, clean, deferred logic. What are your thoughts on gentle thunking? Where have you found it helpful/harmful in your own Lambda development? //The Diagonal Suite - Version 1.0 - 10/27/2025 //Author: Patrick H. //Description: Directional traversal and diagonal logic for 2D arrays. // Functions: // • Traverseλ - Directional traversal engine // • ByDiagλ - Diagonal-based aggregation // • DiagMapλ - Wrapper for diagonal matrix extraction // • DiagIndexλ - Targeted diagonal extraction // • Staircaseλ - Construct diagonal staircases from a vector or 2D array //──────────────────────────────────────────────────────────── //------------------------------------------------------------------------------------------- //Traverseλ - Directional Axis Remapper //------------------------------------------------------------------------------------------- //The selected axis is remapped to the top-left traversal order. //Accepted directions: // "NE" or 1 → Northeast (↗) // "SE" or 2 → Southeast (↘) // "SW" or 3 → Southwest (↙) //Parameters: //array → 2D input array (scalars not accepted) //new_axis → Axis direction ("NE", "SE", "SW" or 1–3) Traverseλ = LAMBDA( array, new_axis, //Input validation IF(OR(ROWS(array)=1,COLUMNS(array)=1), "#2D-ARRAY!", IF(AND(ISNUMBER(new_axis),OR(new_axis<=0,new_axis>3)),"#AXIS!", LET( //Dimensions i, ROWS(array), j, COLUMNS(array), //Axis traversal indices (deferred) x_NE, LAMBDA(SEQUENCE(j,,1,0)*SEQUENCE(,i)), y_NE, LAMBDA(SEQUENCE(j,,j,-1)*SEQUENCE(,i,1,0)), x_SE, LAMBDA(SEQUENCE(i,,i,-1)*SEQUENCE(,j,1,0)), y_SE, LAMBDA(SEQUENCE(i,,j,0)+SEQUENCE(,j,0,-1)), x_SW, LAMBDA(SEQUENCE(j,,i,0)+SEQUENCE(,i,0,-1)), y_SW, LAMBDA(SEQUENCE(j,,1)*SEQUENCE(,i,1,0)), //Axis mode selection mode, IF(ISNUMBER(new_axis),new_axis, SWITCH(new_axis,"NE",1,"SE",2,"SW",3,1)), //Index selection x, CHOOSE(mode,x_NE,x_SE,x_SW), y, CHOOSE(mode,y_NE,y_SE,y_SW), //Unwrap indices and get results result, INDEX(array,x(),y()), result ) ))); //------------------------------------------------------------------------------------------- //ByDiagλ - Diagonal-based aggregation //------------------------------------------------------------------------------------------- //Apply an ETA function or Lambda to diagonals //Parameters: //array → 2D input array (scalars not accepted) //[function] → ETA function or Lambda applied to diagonals //[row_wise_stack?] → Optional: Display results as a vertical stack ByDiagλ = LAMBDA( array, [function], [row_wise_stack?], //Check array input ValidateDiagλ(array,,function,row_wise_stack?, LET( //Optional parameters No_Function, ISOMITTED(function), No_row_wise_stack,ISOMITTED(row_wise_stack?), //Dimensions i, ROWS(array), j, COLUMNS(array), //Diagonal count k, MIN(i,j), //Indices - deferred r, LAMBDA(SEQUENCE(k)*SEQUENCE(,j,1,0)), y, LAMBDA(SEQUENCE(k)+SEQUENCE(,j,0,1)), c, LAMBDA(IF(y()>j,NA(),y())), //Unwrap indices, shape, and aggregate result, IFNA(INDEX(array,r(),c()),""), shaped, IF(No_row_wise_stack,result,TRANSPOSE(result)), final, IF(No_Function,shaped, IF(No_row_wise_stack,BYCOL(shaped,function), BYROW(shaped,function))), final ))); //------------------------------------------------------------------------------------------- //DiagMapλ - Wrapper (Calls ByDiagλ) to extract diagonals as 2D matrix //------------------------------------------------------------------------------------------- //Calls ByDiagλ to extract the diagonals from a 2D array. //Parameters: *Please see ByDiagλ for descriptions.** DiagMapλ = LAMBDA( array, [row_wise_stack?], ByDiagλ(array,,row_wise_stack?) ); //------------------------------------------------------------------------------------------- //DiagIndexλ - Targeted diagonal extraction //------------------------------------------------------------------------------------------- //Extract a diagonal or anti-diagonal vector from a 2D array. //Parameters: //array → 2D input array (scalars not accepted) //col_index → Column number to start from. Negative = anti-diagonal DiagIndexλ = LAMBDA( array, col_index, //Input checks ValidateDiagλ(array,col_index,,, LET( //Dimensions i, ROWS(array), j, COLUMNS(array), //Diagonal direction: +1 = SE, –1 = SW s, SIGN(col_index), //Determine diagonal length based on bounds k, IF(s>0, MIN(i, j + 1 - col_index), MIN(i, ABS(col_index))), start, IF(s<0,ABS(col_index),col_index), //Indices - deferred x, LAMBDA(SEQUENCE(k)), y, LAMBDA(SEQUENCE(k,,start,s)), //Unwrap indices and extract vector deliver, INDEX(array,x(),y()), deliver ))); //------------------------------------------------------------------------------------------- //Staircaseλ — Construct diagonal staircases from a vector or 2D array //------------------------------------------------------------------------------------------- //Parameters: //array → Input array (flattened to vector row-wise) //block_size → Number of rows/columns per staircase block //[block_offset] → Optional padding between staircases //[IsHorizontal?] → Optional toggle for column-wise orientation //[IsAntiDiag?] → Optional toggle to display staircase anti-diagonal. Staircaseλ = LAMBDA( array, block_size, [block_offset], [IsHorizontal?], [IsAntiDiag?], //Check inputs ValidateStaircaseλ(array,block_size,block_offset, LET( //Check optional parameters no_Block_Offset, ISOMITTED(block_offset), zero_Offset, block_offset=0, col_offset, IF(No_Block_Offset,0,block_offset), IsVertical?, ISOMITTED(IsHorizontal?), Not_Anti_Diag, ISOMITTED(IsAntiDiag?), //Convert to vector and get dimensions flat, TOCOL(array), k, COUNTA(flat), seq, LAMBDA(SEQUENCE(k)), V, TOROW(EXPAND(WRAPROWS(seq(),block_size),, block_size+block_offset,0)), width, COLUMNS(V), //Anchors and indices - deferred i, LAMBDA(SEQUENCE(block_size)*SEQUENCE(,width,1,0)), col_arr, LAMBDA(IF(Not_Anti_Diag,SEQUENCE(,width), SEQUENCE(,width,width,-1))), j, LAMBDA(MOD(col_arr(),block_size+block_offset)), j_, LAMBDA(IF((no_Block_Offset)+(zero_Offset), IF(j()=0,block_size,j()),j())), idx, LAMBDA(IF(i()=j_(),V,NA())), //Obtain results, shape, and calculate result, DROP(IFNA(INDEX(flat,idx()),""),,-col_offset), final, IF(IsVertical?,TRANSPOSE(result),result), final ))); //---------------------Error Handling & Validation--------------------------- //Validates inputs for Staircaseλ. Please see Staircaseλ for parameter //descriptions. ValidateStaircaseλ = LAMBDA( array, block_size, [block_offset], [on_valid], LET( //Checks NotArray,TYPE(array)<>64, Invalid_block_size, OR(ISTEXT(block_size),block_size<=0,block_size>COUNTA(array)), Invalid_block_offset, OR(ISTEXT(block_offset),block_offset<0), //Logic gate IF(NotArray, "#NOT-ARRAY!", IF(Invalid_block_size, "#BLOCK-SIZE!", IF(Invalid_block_offset,"#BLOCK-OFFSET", on_valid)))) ); //---------------------Error Handling & Validation--------------------------- //Validate inputs for ByDiagλ, DiagMapλ, and DiagIndexλ. //*Please see those functions for parameter descriptions.* ValidateDiagλ= LAMBDA( array, [col_index], [function], [row_wise_stack?], [on_valid], LET( //---Checks--- //Array input IsArray?, TYPE(array)=64, Not_Array, NOT(IsArray?), //Col_index No_Col_Index, ISOMITTED(col_index), Col_Index_Included, NOT(No_Col_Index), Not_Valid_Col_Index?, NOT(AND(col_index<>0, ABS(col_index)<=COLUMNS(array))), //Function No_Function, ISOMITTED(function), Function_Included, NOT(No_Function), Invalid_Function?, AND(ISERROR(BYROW({1,1},function))), //Shaping input RowWiseStack?, NOT(ISOMITTED(row_wise_stack?)), //Deterine which function is being validated DiagIndex, Col_Index_Included, ByDiag, AND(No_Col_Index, Function_Included), DiagMap, AND(No_Col_Index, No_Function), //Logic gates //DiagIndexλ a, IF(Not_Array, "#NOT-ARRAY!", IF(Not_Valid_Col_Index?,"#COLUMN-INDEX!", on_valid)), //ByDiagλ b, IF(Not_Array, "#NOT-ARRAY!", IF(Invalid_Function?, "#FUNCTION!", on_valid)), //DiagMapλ c, IF(Not_Array, "#NOT-ARRAY!", on_valid), //Logic gate selection decide, IF(DiagIndex,a, IF(DiagMap,c, IF(ByDiag,b, "#UNROUTED!"))), decide )); //End of The Diagonal Suite - Version 1.0 //Author: Patrick H.18Views0likes0CommentsHelp Needed: Add Interactive Dashboard to Landowner Engagement Tracker (Same Sheet)
Hi all, I’ve built a basic Excel tracker to monitor engagement with landowners for a large infrastructure project. The purpose of the tracker is to: Show progress tracking of each case of for the project director to monitor progress help the Project Director Identify which cases may require statutory powers to secure access (if voluntary agreement isn’t possible) This helps our leadership team make informed decisions quickly. What I’ve got: A sheet called "LANDS RIGHT TRACKER" Columns include: Reference Number Agreement Status Case Status Risk Level (High/Medium/Low) Willingness to enter agreement Reason for refusal Flag for whether statutory powers may be needed 🛡️ All data is fictitious — names and details are placeholders, so no privacy concerns. What I need help with: my level of excel knowledge is very basic and I was hoping for some assistance to: Add an interactive dashboard and key metrics directly on the same sheet (not a separate worksheet). The below is just my suggestions as you are the expert your guidance expertise is much welcomed, happy for you to put it straight on to the tracker as I have left a section on the tracker for you to insert your items Ideally using a Pivot Table and Slicers to filter by: Case Status Risk Level Agreement Status Willingness to enter agreement https://docs.google.com/spreadsheets/d/1c2IJ-YLsTN-DZE9ltw0JR-nGVuuGzTKE/edit?usp=drivesdk&ouid=104511246399228274463&rtpof=true&sd=true28Views0likes1CommentData Import issue???
I am working on a drift formula for items being pushed by wind and waves on the water. I imported a text file of weather data, formatted all the data to numbers, and built an "if" formula to convert the wind direction into drift direction. Wind from 360 degrees (north) would cause an item to drift 180 degrees (south). The problem is the formula sees everything as false. Is this a formatting issue with the imported text? =IF(B28<180,B28+180,B28-180)29Views0likes1CommentHow to create a Date-Time Temperature Graph
Hi there, I was wondering if Excel is able to create a similar Date Time vs Temperature graph as shown, the green coded one? (the data was extracted from an app) I want to be able to show the Date AND Time on my Excel chart I have the raw number data but is unable to convert it into a graph similar to the one shown above, for reference the format of my raw data looks like this (below), but my raw data have three thousands results. Thank you in advance to anyone who can help me! - Non33Views0likes1CommentUpdate Excel formulas between a path in local folder and owncloud in another computer
I have a lot of Excel archives with lots of formulas which reference other Excel files, all in the path H:\Fold\Data\physics on a computer, and at the same time, on another computer, I have an owncloud folder C:\Users\fulanito\ownCloud\Shared\Data\physics. How could I change the paths in formulas to be able to update the data when I open them in the owncloud folder or in the original folder? They share part of the same route: \Data\physics The local folder on one computer (H:\Fold\Data\physics) is synchronized with owncloud, I share the folder Data. Mounted folder in owncloud in another computer: C:\Users\fulanito\ownCloud\Shared\Data\physics I tried to use relative paths but that works only if all archives are in the same folder. In my case for the owncloud path, for example one archive, data_2025.xlsx is in C:\Users\fulanito\ownCloud\Shared\Data\physics\2025 another, data_2024.xlsx, is in C:\Users\fulanito\ownCloud\Shared\Data\physics\2024 the Excel that use formulas with references to these two archives is in C:\Users\fulanito\ownCloud\Shared\Data\physics\summary. So if I want to update the summary archive daily_summary on the computer with owncloud, all the archives have to be in the same subfolder \summary\ Examples of formulas I use in the summary sheet to reference my files in H, in Excel daily_summary.xlsx are ='H:\Fold\Data\physics\2025\[data_2025.xlsx]Horario'!AV1419 and in another cell next to this is: ='H:\Fold\Data\physics\2025\[data_2024.xlsx]Horario'!AV1419 So if a make a change in data_2025 in that cell and I open on the computer with owncloud, it can't update because it references the local computer H:. I prefer not to use macros.Solved63Views0likes3CommentsHow to make excel add or remove rows to fit data and prevent spill error?
Hello! My question is: When using the =FILTER formula to copy cell data from one sheet to another, how can I make excel add or remove rows as needed to prevent a spill error? I am using the =FILTER formula to copy cell data from one sheet to another if a checkbox is checked. My formula uses the cells containing the checkbox (column A) as the reference for columns B, C, D, etc. to the right. I did this by selecting the cell that has the formula on the destination sheet, highlighting this cell and those to the right I wanted to transfer, and then control + r. My formula is: =FILTER('Source Sheet'!B5:B13,'Source Sheet'!$A5:$A13=TRUE) (If there is a way to copy an entire row from the source sheet instead of having to control+r to apply the original formula across select cells please also let me know, thank you!). However, I want the sheet to be able to automatically add rows to fit the data if the selected number of rows is greater than what I have left available on the sheet. Currently, if I leave 3 rows for data to fill and I select three checkboxes, this will fill the space with no problem. However, if I select 4+, I get a spill error (as there are not enough empty rows to put the data). Is there any easy way to have excel add rows as needed? Similarly, is there a way for excel to remove rows as needed? I am going to use this sheet to detail all medications being taken by family members (with medication name, concentration, dose, time to take each in their own column as column B, column C, column D, column E). The names will be listed in column A with ~3 rows below each name which will fill when the checkbox on the source sheet is clicked. I want to ideally fit this on one page when printing without major "fit to page" problems that come up during printing. The layout of the sheet will ideally look like this: The goal for the 'destination sheet' is to pull only the selected data I want to use from my master list on the 'source' sheet.' I want to avoid having a big empty space under each family member where they don't take many medications, and to also not have to manually add rows for family members that take a greater number of medications. Please let me know and thank you!87Views0likes3CommentsHelp with data and visuals
I hope i can explain this right, i have data that shows 3 things: person, start date and end date: now i need excel to take this information and represent it as the following in the month tracker: It would look for the charts and figure out the timeline and add them to a row with the timeframe: example is Booy 15-0ct-25 to 23-oct-25 the char would go to the next one and add his information, I hope someone can help me. I just need it to populate the month tracker, Thanks100Views0likes3Comments