Formulas and Functions
24206 TopicsPivot Table Yearly Sales Report Issue
I'm currently working on creating a pivot table for a yearly sales report. However, I'm encountering an issue where, after a particular row, the year is not being recognized. This results in an error. Can someone please explain why this might be happening and guide me on how to resolve it? Additionally, is there a way to directly convert the date to year within the pivot table without having to separately convert the date to year first and then use the pivot table?27Views0likes2CommentsWorking with Arrays of Ranges
OK, so strictly speaking an array of ranges is an error in Excel right from the outset. However, I set up an array of tables contained within the named Range 'allocatedRange', here shown with a red outline. I then set up a function that would return the range corresponding to a country SelectDataλ = LAMBDA(country, LET( countries, FILTER(TAKE(allocatedRange, , 1), markers = "Country:"), recordNum, FILTER(SEQUENCE(ROWS(allocatedRange)), markers = "Country:"), recordEnd, VSTACK(DROP(recordNum - 1, 1), ROWS(allocatedRange)), rangeRows, recordEnd - recordNum, countryArrϑ, MAP( recordNum, rangeRows, LAMBDA(start, rows, LAMBDA(TRIMRANGE(TAKE(DROP(allocatedRange, start), rows)))) ), XLOOKUP(country, countries, countryArrϑ)() ) ) The start and row count of each table is determined by using the string "Country:" as a marker and differencing row numbers. A combination of TRIMRANGE/TAKE/DROP picks out each range in turn and assembles them into an array by turning the range references into thunks (TYPE=128). The function SelectDataλ is used to look up any specific country and return the corresponding range. To demonstrate that the function indeed returns ranges, the COUNTIFS function is used to count the number of cities within each country that have a population exceeding 100 000. = LET( countries, FILTER(TAKE(allocatedRange,,1), markers="Country:"), countLarge, MAP(countries, LAMBDA(country, COUNTIFS(TAKE(SelectDataλ(country),,-1), ">1000000") ) ), HSTACK(countries, countLarge) ) The point of this post is to introduce the idea of treating tables as elements of an array, so allowing further tables to be inserted or removed dynamically. TRIMRANGE ensures that each range is sized correctly and MAP is used to analyse each table in turn. Whilst Excel throws hissy fits at being asked to store arrays of arrays, arrays of ranges, or nested arrays, it is perfectly happy to store arrays of functions. When evaluated, each element of the function array is perfectly free to return an array or even a range. The effect is to permit Excel to process 'arrays of Tables' faultlessly.204Views1like12CommentsMail Merge to Email Addresses
Need some help. I am using Excel as a data source and created word document templets for mail merging. With in the data source I have for columns for entering email addresses. Personal Email address Work Email Address Supervisor Email Address Section Email Address Combined Email Address When I need to send an email to an individual that also needs to go out to all the emails, I have joined the email addresses together using the following formula and have the combined email addresses in a column called Combined. =LET(email,TEXTJOIN("; ",TRUE,T3:U3,AS3:AT3),IF(email="","",HYPERLINK("mailto:"&email,email))) This works with no issues and am able to click on a combined email line and it launches the email program and drops the line of EMAIL ADDRESSES into the email TO: location. The issue I need help with, if possible, is the interaction with the combined email and word mail merge. When I try to do the mail merge and select the Combined Email Address column, word gives me an error, "Microsoft Outlook does not recognize " the list of combined email addresses". Is there a way for outlook to recognize the combined email addresses during the merge? Any help would be greatly appreciated. Carl87Views0likes5CommentsConditional Formatting Help
Hi Everyone, I have been working on this problem for weeks and still can not find an answer: I am creating a spreadsheet which involves completing specific tasks by different members. I have formatted the cells to change colors based on the answer of another cell. basically as a reminder to complete it. Now here is my problem, Cell AO7 is under the title project completed. what I am wanting is for that cell to be Red if any of the cells in data range D8:N66 are red. that way we know the project still has an item that needs to be completed. Hope I explained that right. Also, rows 8-66, will be copied and pasted to create the tasks for other projects31Views0likes1CommentPower Query Formula to Calculate Current Count From Previous Count per Name using Date
Hi everyone! I have a dataset with the following columns: Point Name, Pump Count, Record Date, and Index. My goal is to create a calculated column in Power Query that computes the following for each Point Name, based on the Record Date: If (Current Pump Count - Previous Pump Count) >= 0, apply: (Current Pump Count - Previous Pump Count) * 0.3 If the result is negative, use this formula instead: ((1,000,000 - Current Pump Count) + Previous Pump Count) * 0.3 Problem: I tried duplicating the Pump Count column and creating a custom column for the previous count using Table.Buffer, but it didn’t align correctly by Point Name and Record Date. Indices may not be sequential, so referencing the immediate index won’t work. I considered grouping by Point Name and sorting by Record Date to dynamically calculate the Previous Pump Count, but was unsure. I tried this formula for Previous Pump Count but it doesn’t align correctly for Point Name or handle skipped indices. My Current Formula: Table.Buffer(#"Duplicated Column3")[Pump Cycle Count]{[Index] - 1} otherwise null Desired Process: Group by Point Name. Sort within each group by Record Date Use the formula to compute the difference: If (Current Pump Count - Previous Pump Count) >= 0, apply: (Current Pump Count - Previous Pump Count) * 0.3. Else, apply: ((1,000,000 - Current Pump Count) + Previous Pump Count) * 0.3. How can I implement this in Power Query, ensuring it dynamically references the Previous Pump Count for the same Point Name, even if indices are skipped or Record Dates are close?35Views2likes2CommentsI don't understand this logic with StockHistory function...
I don't understand this.... I will show my question step by step: 1. =STOCKHISTORY(E4,TODAY()-10,TODAY(),,0,1) Gives me an array. 2. I use ROWS and INDEX to get the last number of the array. =INDEX(STOCKHISTORY(E4,TODAY()-10,TODAY(),,0,1),ROWS(STOCKHISTORY(E4,TODAY()-10,TODAY(),,0,1))) gives me the last number of the array. 3. I change "E4" to "E4#" =INDEX(STOCKHISTORY(E4#,TODAY()-10,TODAY(),,0,1),ROWS(STOCKHISTORY(E4#,TODAY()-10,TODAY(),,0,1))) Gives me the 0.67....which is the price of "8zz" the last one on E4#. I was expecting to get the last number of each and every StockHistory array of every elements in E4#... Instead, I only get the "first" number of the last element in E4#. I don't understand the logic of this function....Can anybody explain this strange behavior? Thank you very much!Solved83Views0likes6CommentsHelp needed to link IF functions into 1 cell
Hi All, I have a tracker spreadsheet that upon entering dates into cells, there is a calendar section at the end where the dates populate into there in the forms of numbers - which are then conditional formatted to different colours based on stages of the project. As there are 5 main stages to our projects, currently I have 5 rows - one for each stage. But, I don't want to have 5 rows, so was hoping there would be some way to combine these IF functions (each of which contain OR and AND functions) into 1 overall formular, so I can have 1 row that contains all. The attached screenshots hopefully make this clearer than I may have explained: Formulars: T2 - =IF($B2="","",IF(OR(AND($B2<T$1,$H2>T$1),AND($B2>T$1,$B2<U$1)),1,0)) T3 - =IF($I2="","",IF(OR(AND($I2<T$1,$M2>T$1),AND($I2>T$1,$I2<U$1)),2,0)) T4 - =IF($N2="","",IF(OR(AND($N2<T$1,$O2>T$1),AND($N2>T$1,$N2<U$1)),3,0)) T5 - =IF($P2="","",IF(OR(AND($P2<T$1,$Q2>T$1),AND($P2>T$1,$P2<U$1)),4,0)) T6 - =IF($R2="","",IF(OR(AND($R2<T$1,($S2+28)>T$1),AND($R2>T$1,$R2<U$1)),5,0)) Does anyone know if the formulars in T2: T6 can be combined so the cell will fill and 1 to 5 value based on the associated date, which then formats to the colour I want? Or even if there is another way to achieve this? Thanks in advance, MattSolved86Views0likes8CommentsDax measure not considering the filter context and not aggregating
Hi, I have the below visual and highlighted Dax is having problem: Below is Dax: noofdays = COUNTROWS(Calendar_) For the below selected filters, noofdays dax should display 60 for month of September 2024 and 62 for month of October 2024. The total aggregate value should be 122 days. But this dax is giving wrong values now. FYI, when I bring in DBName-Points_Id into the visual,it is giving correct values row by row but when removed it doesn't: FYR, My expected output should be like below: PFA file here Portfolio Performance - v2.15 (1).pbix Please let me know if you need further info! Thanks in advance! SergeiBaklan84Views0likes6CommentsFV (Future Value) conundrum!
Future Value (FV) Conundrum! Example Starting Amount $100,000, Term 3 and Interest Rate 3%. Standard formula is FV=PV*(1+rate)^Term To agree with first web calculator I tried,(for inflation), I turned the term to a NEGATIVE. Answer using Standard Formula with NEGATIVE exponent, answer is $91,514.17 Using Excel Function=FV(rate,nper,pmt,[pv],[type]) with NEGATIVE NPER, answer is $91,514.17, which is in agreement with standard formula result above. Answer from WEB site BankofCanada calculator AND Buyupside calculator all in agreement, all say $91,514.17 BUT...... Web site calculator dot net calculates it different as$91,267.30!! Web site vertex42 agrees with$91,267,30 Excel array with agrees with $91,267,30!! Year Principal After Inflation 1 $100,000.00 $97,000.00 ←*0.97 2 $97,000.00 $94,090.00 ←*0.97 3 $94,090.00 $91,267.30 ←*0.97 So which one is correct? Difference of two hundred forty six and eighty seven cents! What am I doing wrong?Solved85Views0likes4Comments