I'm stuck on an Excel problem and am hoping someone can assist. I read through 10-15 topics that are similar, but I wasn't able to get anything to work. Here is where I'm at...
I have a large data set containing columns for Year, Name, Total 1, Total 2 (and 20+ other columns). The same names appear in multiple rows based on the yearly totals. On a separate sheet, I have another data set containing Name and would like to pull the data from sheet one into columns as shown below.
I have done this in the past using only one year as the initial data set with the following formula:
=INDEX(DATARANGE,MATCH([#Name],DATARANGE[Name],0),MATCH("Total 1",DATARANGE[#Headers],0))
The problem I am having is the result of adding multiple years of data to my 1st data set. Is there a way to match the row based on name and year and then return the results of the appropriate column?
=SUM(($A$2:$A$9=B$16)*($B$2:$B$9=$A17)*($C$2:$C$9))
Enter above in cell B14 as an array formula or below as standard
=SUMPRODUCT(($A$2:$A$9=B$16)*($B$2:$B$9=$A17)*($C$2:$C$9))
You can do the same for total 2 just replace Cs with Ds
And then drag right and down.
Change the first MATCH function to something like this:
=MATCH(1,INDEX(([#Name]=DATARANGE[Name])*([#Year]=DATARANGE[Year]),0),0)
so as part of your whole formula that would be this
=INDEX(DATARANGE,MATCH(1,INDEX(([#Name]=DATARANGE[Name])*([#Year]=DATARANGE[Year]),0),0)
,MATCH("Total 1",DATARANGE[#Headers],0))
Another way you can use for returning numbers only (as here) is like this: (with cell refs for simplicity).
=SUMPRODUCT((A2:A9=2013)*(B2:B9="name x")*(C1:D1="Total 1"),C2:D9)
If the presented data to be indexed is a table then
This
=MATCH(1,INDEX(([#Name]=DATARANGE[Name])*([#Year]=DATARANGE[Year]),0),0)
should be corrected to a proper structured reference of
#[Name]
Also since this is an array formula it may not work with structured references at all. You'd be better served with regular cell references. Also if it is not a table only cell references will work.
Related
I am new to excel formulas and vba etc. thats why i have no idea how to solve this problem.
Problem:
I want to create a dynamic chart using the offset function. Basically i want to show in my chart
the last 7 entries from the newest entry and insert all the data from the columns in it.
The current code that i used is this:
Bereich.verschieben is german for offset btw.
=BEREICH.VERSCHIEBEN(Historie!$C$307:$C$312;0,0;1;Charts!$B$58-1)
I want something like:
=BEREICH.VERSCHIEBEN(Historie!$C$307:$C$312;**0:5**;0;1;Charts!$B$58-1)
to show the data in the whole range. And i would like to add the part where i only show the last 5 entries from the current filled cell. In the picture below for example, from Col L to Col H all the data should be shown.
What i current got is this:
The Data in the chart is further on the back with the current date. Thats why the numbers dont match up exactly.
I recreated a data table similar to yours (the exact length and values are not important for the formulas):
I understand that you want to create a dynamic array similar to the one shown here:
The one shown here has been created using 3 formulas in the highlighted cells.
There are 2 ways to write these formulas that immediately come to mind. a) using INDEX() functions or b) using OFFSET() functions.
Starting with the INDEX() based formulas:
the formula for the machines is =TRANSPOSE(Historie!$B$307:$B$312)
for the last 5 dates =LET(Dates,Historie!$306:$306,INDEX(Dates,1,SEQUENCE(5,1,MATCH(MAX(Dates),Dates,0)-4)))
and for the values you can then use =LET(Data,Historie!$307:$312,Dates,Historie!$306:$306,INDEX(Data,SEQUENCE(1,COLUMNS(C3#)),MATCH(B4#,Dates,0)))
where the direct cell references correspond to the arrays as shown in the screenshot further below.
And the OFFSET() based formulas:
the formula for the machines is the same =TRANSPOSE(Historie!$B$307:$B$312)
for the last 5 dates you can use =LET(Dates,Historie!$306:$306,TRANSPOSE(OFFSET(Dates,0,MATCH(MAX(Dates),Dates,0)-5,1,5)))
and for the values =LET(Data,Historie!$307:$312,Dates,Historie!$306:$306,TRANSPOSE(OFFSET(Data,0,MATCH(MAX(Dates),Dates,0)-5,6,5)))
Both alternatives generate the same table as shown here below:
Note: In both alternatives, I hard wrote some numbers into the formulas that imply that you want to extract the values for exactly 5 dates and exactly 6 machines. If either one or both of those numbers shall be variable, adjustments have to be made accordingly.
Edit 1: Avoiding LET() function
When the LET() function is not available for your purposes, the above formulas can be rewritten. I will leave out the 1st of the 3 formulas since it doesn't use LET()
INDEX() based formulas:
the dates formula is =INDEX(Historie!$306:$306,1,SEQUENCE(5,1,MATCH(MAX(Historie!$306:$306),Historie!$306:$306,0)-4))
the formula for the values is =INDEX(Historie!$307:$312,SEQUENCE(1,COLUMNS(C3#)),MATCH(B4#,Historie!$306:$306,0))
OFFSET() based formulas:
the dates formula is =TRANSPOSE(OFFSET(Historie!$306:$306,0,MATCH(MAX(Historie!$306:$306),Historie!$306:$306,0)-5,1,5))
the formula for the values is =TRANSPOSE(OFFSET(Historie!$307:$312,0,MATCH(MAX(Historie!$306:$306),Historie!$306:$306,0)-5,6,5))
These adjusted formulas generate the exact same table as the LET-formulas above. See Screenshot
The entire workbook is a few sheets long, however essentially I'm working with a base sheet that has around 8000 or so lines data with about 10 columns or so. The end goal of this project is to be able to input a start date, end date and a keyword and then be filtered one last time with another keyword. So far, I've been able to filter down the original data within the date range and within the first keyword. The problem arises now when the keyword is within a block of text that varies and is never quite the same. For example, one row contains
12T Q1FY23 Unscheduled/Emergency Maintenance
While another row contains
12T Q4FY23 ERT Spill Stations
There are hundreds of variations of this, but there, including ones that don't start with "12T". The starting data is subject to change so I can't quite use tables in excel and filter it that way, as once you apply a filter then the table won't update if new data is input as the source data, unless there is a way to do this and I just don't know how. So ultimately, I need the same filter that can be used on a table that says "contains" and/or "does not contain" as formulas. Formulas seem to work well with this dynamically/subject-to-change source data, so I'd like to keep it with formulas, as I have done with the filtering previously with the date range and then with the other keyword. The difference between what I want now and what I did for that other keyword is that it was a static keyword that isn't embedded within a string like the "12T". Please let me know if this is too vague or if there's any more material needed to help answer this question. Attached is a sample image of a what I'm working with on the original sheet. I'd like to be able to extract the rows containing only "12T", and not the one's "12T-M", for example, using only a formula. Assume that the data starts at A3 and ends at C8. I should also mention, just to be completely clear, I'm trying to copy these rows dynamically into another sheet so that it can be nicely viewed with only the relevant information and data.
To be extra clear, I first filter it the original data with the following formula:
=INDEX(Sheet1!$A$6:$N$6796, SMALL(IF(COUNTIF('12T'!$H$11,Sheet1!$G$6:$G$6796), MATCH(ROW(Sheet1!$A$6:$N$6796),ROW(Sheet1!$A$6:$N$6796)), ""), ROWS(B3:$B$3)), COLUMNS(Sheet1!$A$6:A6))
The "Sheet1" referral contains the original data and "12T" refers to the sheet that contains the filtering keywords (the dates and the number keyword). This formula extracts all of the rows of the original dataset in Sheet1 that contain a specific keyword, in this case its "5351 - Facilities: Maintenance: Building". These extracted rows of data are deposited as an array (Entered with ctrl+shift+enter) in a new sheet labeled "Xtract".
In this same sheet, I then filter out this array with the date range in mind. With the starting and ending date, I first calculate the number of instances that a date falls within the date range with the following formula.
=SUMPRODUCT(($A$2:$A$671>=Q2)*($A$2:$A$671<=Q3))
I use this result in the following formula in conjunction with the filtered data (filtered with the previous keyword) to filter it further so that I only get the rows of data that have their date in the date range.
=FILTER(A2:O671,(A2:A671>=Q2)*(A2:A671<=Q3),"No data")
This is also entered as an array, and is also in the "Xtract" sheet. With this filtered data set, I want to filter it one last time, so that only the rows of data that contain, for example, "12T" or "728M" in one of the cells (in which the respective cell can be written as "12T Q1FY23 UEM") can get extracted and placed into a final array. All of this is automatically updated simply by entering the values in this section I have shown below.
I can't use a table to filter the data, at least not that I know of, because if I filter a table by this logic ("contains '12T'" and "does not contain '-M'" to get only rows that contain 12T but not 12T-M or anything that's not 12T) then once I change the date range or the other keyword, the table won't update properly. If there's anything else I can add to help clarify, please let me know.
Add a column to the left containing formulae: "=find("12T ",B1) and copy down.
Note the space after T.
Rows matching that will have 1; rows not matching will have #VALUE! so you can sort on them.
P.S. if #VALUE! is ugly, you can use =NOT(ISERROR(FIND("12T ",B2)))
After a lot of searching and referencing my old work/internet, I found the formula to answer my problem. I understand this might not be the most clear since I can't quite provide the excel workbook I'm working with, but the goal of this was to automate all of the filtering so that no matter if data is added or not, when you change the filters, it will stay updated correctly. From the filtered data that I had already worked with, all I had to do to put it into another sheet was use the following formula:
=FILTER(XtractFilters!T2:AF900,ISNUMBER(SEARCH("12T *",XtractFilters!T2:T900)))
This finds all of the data containing a specific substring, which in this case specifically was "12T ", denoting the space as well. So all of the filtered results are then filtered once again so that only the rows where "12T " was found get returned. The range is just the entire range of data and then the column is the one containing the text where "12T " could be found.
I am trying to find a function that will look through all of the sheet to find unique names and sum the value that was assigned at a specific date like below: (End result should be like the summary) - I am restricted to use this format and can't have all the names under one column and dates under another.
A simply old fashion Sumif function is enough.
In I2, formula copied down :
=SUMIF(A:E,H2,B:F)
"I am trying to find a function that will look through all of the sheet to find unique names and sum the value that was assigned"
Assuming:
You indeed don't know the names beforehand (and over the course of 800+ columns and idemt dito rows (or more), it's "impossible" to write these out beforehand);
You have an arbitrairy range (of up to 800 columns and many rows);
Access to the BETA-channel of ms365.
Formula in H3:
=LET(X,WRAPROWS(TOCOL(A3:F5,1),2),Y,INDEX(X,0,1),Z,UNIQUE(Y),HSTACK(Z,BYROW(Z,LAMBDA(a,SUM((Y=a)*INDEX(X,0,2))))))
Note: The above is based on the assumption you don't know the unique names up front (as stated in the body of your question). Admittingly, if these are known, there are other/better answers.
So laid the data out like so and used sumifs():
SUMIFS($C$2:$C$8,$B$2:$B$8,F2)
Will let you consider adding a date control: prior to, equal to or after...
If you say you cannot change the source data, then make a data sheet to copy all the data, do the results like I show then link the results over...
So if you have to keep the format (instead of copying the data as already suggested - perhaps you missed that as you did not address that in your comment) then you could use sumifs() multiple times like so:
And just for fun playing with date control, still using your format:
Thank you for taking the time to read this and maybe answer this for me.
I am currently referencing a cell within an array like so:
=INDEX('CampPerf Output'!$1:$1048576,9,55)
This data unfortunately can move up and down along the columns of the array. For example, sometimes it will not be Row 9, it will be on
=INDEX('CampPerf Output'!$1:$1048576,8,55)
=INDEX('CampPerf Output'!$1:$1048576,10,55)
=INDEX('CampPerf Output'!$1:$1048576,11,55)
You never know, because the data above it may be absent for this particular day's reporting (its call volume for lines of business in a call center setting. Some lines of business don't receive any calls that day.)
New data is INSERTED, but will always land in column BC (Column 55). New data is inserted to the left, pushing cells right. Since the data can move up and down, and the references of a vlookup move as new data is inserted, my question is this:
Can I combine my Index and a vlookup in a way that makes the lookup column absolute, no matter what is inserted or deleted.
Use:
=VLOOKUP('Conversion'!J1,INDEX('CampPerf Output'!$1:$1048576,0,55):INDEX('CampPerf Output'!$1:$1048576,0,65),2,FALSE)
This mimics your vlookup you provided, it looks in the range BC:BM. Vlookups can use full column references, the 0 in the second criterion includes all the rows.
I'm having a very difficult time with transitioning my VLOOKUP statement from simply referencing sheets and ranges (which work like a charm), to instead using table and column names.
I'm trying to make the VLOOKUP a bit more robust as the sheet where it is pulling from will constantly be changing data, so column numbers will change frequently. Thus, I'd like to just reference a column by its name.
I have converted the source data sheet to a table.
I have named all columns appropriately and double checked spelling.
This VLOOKUP works great (currently):
=VLOOKUP(E6,'Costs'!$A$2:$AE$84,19,FALSE)
However, what I would like to do is make it look this:
=VLOOKUP(E6,tblCosts[Order Number],tblCosts[June 2017], FALSE)
I have been fiddling with also trying to use MATCH which is not working either:
=VLOOKUP(E31,tblCosts[Order Number],MATCH(F4,tblCosts[June 2017],FALSE),FALSE)
UPDATE
This formula now works but it is returning the order number...not the cost for the month.
=VLOOKUP(E31,(tblCosts[Order Number]),(tblCosts[June 2017]),FALSE)
Normally I would keep trying this myself...but I am feeling overwhelmed and have been trying for hours. Any advice would be great.
Thank you!!
This should work for you:
=VLOOKUP(E31,tblCosts[#All],COLUMN(tblCosts[Jun-17]),false)
The COLUMN(TblCosts[Jun-17]) returns the column number of the field you want.
The VLookup searches the first column of tblCosts[#All] - (all the data in the table) for the data (in E31) and returns the data in the column you want.
This formula will continue to work even if you add columns or rows to the data.
Make sure that any heading which looks like a date in your spreadsheet eg "Jun-17" is stored as Text and not as a Date, as it will not match the string "Jun-17" when you use VLookup.
=VLOOKUP(E37,tblCosts[#All],match("Jun-17", tblCosts[#Headers]),FALSE)
This match is looking for the column name in all column headers and will return the number of columns to the right of the first column rather than the column number in the sheet. This avoids having to use COLUMN(tblCosts[Jun-17]) - COLUMN(tblCosts[Order Number]) + 1 when your table doesn't start in column A.
Ref: https://www.excel-university.com/vlookup-hack-4-column-labels/