Sorry this is a basic question but will try to explain clearly.
I have two worksheets. One a summary and the other that holds the raw data. In the summary tab in cell A1 I have a drop down with each day dd/mm/yyyy.
What I want to do is to find the same date in the raw data table and then look down a set amount of columns and then look across a set about of rows and return that as my value in the summary sheet.
Been trying but can only get to look down or across a column or row and not both.
I think I didn't get enough sleep last night!
Thanks in advance for any help at all.
Without an exact example to apply this to, I'm guessing what you want is offset match match.
As per the formula on the link, you want:
= OFFSET ( starting point , MATCH ( vertical lookup value, left hand lookup column excluding starting point , 0 ) , MATCH ( horizontal lookup value , top header row excluding starting point , 0 ) )
So, if I'm understanding correctly, you have a dataset that looks a bit like this:
Below the data I have example of items you want to find. This probably isn't the cleanest way to do this, but say you want the "hit" column for Operation 2 on 03/07/1989, then it would be:
=OFFSET(A1,MATCH(A10,A1:A5,0)-1,MATCH(A9,A1:H1,0))
This will return "0.81544".
To get the right data, you'll need to mess about with the - and + at the match formulas, and without seeing your data set it's hard to get you exact examples, I hope it helps though! I had to modify it slightly due to the fact I believe that your top row will include the dates as well as the column headings for each. Going through the linked guide should help you plenty to tailor it to your needs.
Related
The solution to this problem has been evading me and admittedly hurting my brain a little bit, so hopefully someone here can lend a hand. Essentially, I have around 10 columns of data. One of these columns contains the identifier I want to use, another column has the date I want to reference, and the rest of the columns are the values I want to use to populate the table. What I'm trying to do is build a tool where you type in the identifier and the date and it tells you what the other columns are for that particular pairing.
The problem is, however, that the data set contains multiple repeated dates (dates are in a column), and sometimes repeated identifiers. So identifier 1 may appear three times on 1/1/2018, then appear three more times on 1/2/2018.
Forgive my inexperience, as this is probably the incorrect way to show this, but this is what I want my data to look like, with the bins being the 1st, 2nd, and so on occurrences of the same identifier on the given date:
Identifier - A1
Date - 1/1/2018
Bin Column1 Column2 Column3 Column4
1 1 2 3 4
2 1 2 3 4
3
4
5
The Identifier and Date would be manual entries and the rest of the table would be automatically populated. I've been looking up different ways of using index(match()) all morning and have yet to achieve any success. I'm not sure if I'm approaching this incorrectly or what, but any help with this problem is greatly appreciated.
PS - I understand that a pivot table would likely give me the information I need, however, this table isn't for my own use, so I'm trying to make it as straightforward as possible (enter two lines, necessary info pops up).
Edit - This is how the data is currently set up:
`
Use this:
=IFERROR(INDEX(C:C,AGGREGATE(15,7,ROW($B$2:INDEX($B:$B,MATCH("zzz",$A:$A)))/(($B$2:INDEX($B:$B,MATCH("zzz",$A:$A))=$J$2)*($A$2:INDEX($A:$A,MATCH("zzz",$A:$A))=$J$1)),ROW(1:1))),"")
Note: realize this is an array formula that is entered normally with Enter, but as an array formula it will slow down the calcs if the dataset is large.
It generally looks like:
=INDEX('range all of the data, not the headers', MATCH('row header value to match','the row headers range',0), MATCH('column header to match','the column headers range',0))
I have 3 tables, 1 of which I want to fill in columns with data based on the other 2. Tables are roughly structured as follows:
Table 1 (Semi-Static Data)
SubGroup Group
----------- -----------
subgroup(1) group(a)
subgroup(2) group(b)
subgroup(3) group(b)
subgroup(4) group(c)
etc.
Table 2 (Variable Data)
SubGroup DataValue
----------- -----------
subgroup(1) datavalue(i)
subgroup(2) datavalue(ii)
subgroup(3) datavalue(iii)
subgroup(4) datavalue(iv)
etc.
Table 3 (Results)
Group TotalValue
----------- -----------
group(a) totalvalue(m)
group(b) totalvalue(n)
group(c) totalvalue(o)
etc.
Where the TotalValue is the sum of all DataValue's for all subgroups that belong to that particular Group.
e.g. for group(b) ---> totalvalue(n) = datavalue(ii) + datavalue(iii)
I am looking to achieve this calculation without adding any additional columns to the Data tables nor using VBA.
Basically I need to perform a COUNTIFS where there is an additional VLOOKUP matching the subgroup criteria range to the group it belongs to, and then only summing for datavalue's that match the group being evaluated. I have tried using array formulas but I'm having issues making it work. Any assistance would be very appreciated. Thank you,
EDIT: Wanted to add some details surrounding my question. First all Google searches did not provide a suitable answer. All the links had solutions to a slightly different problem were the VLOOKUP term is not dependent on the SUMIFS criteria but rather another single static variable. Stack Overflow offered similar solutions. Please let me know if anymore details are required to make my post suitable for this forum. Thank you again.
You can use the SUMPRODUCT function to do it all at once. The first reference $B$2:$B$5 is for the Group names, the second reference $E$2:$E$5 is for the datavalues. The G2 reference is for the group names in the third table, you can enter this formula for the first reference and then drag and fill for the rest.
=SUMPRODUCT($E$2:$E$5 * (G2 = $B$2:$B$5))
Some cell references, and sample data, would be helpful but something like this might be what you want:
=SUMIF(C:C,"="&INDEX(A:A,MATCH(E5,B:B,0)),D:D)
WADR & IMHO, this is simply bad worksheet design. For lack of a single cross-reference column in Table2, any solution would have to be a VBA User Defined Formula or an overly complicated array formula (the latter of which I am not even sure is possible). The data tables are not normalized database tables you can INNER JOIN or GROUP BY ... HAVING.
The formula you are trying to achieve is akin to,
=SUMPRODUCT(SUMIF(D:D, {"subgroup(2)","subgroup(3)"}, E:E))
That only works with hard-coded values as arrayed constants (e.g. {"subgroup(2)","subgroup(3)"}). I know of no way to spit a dynamic list back into the formula using additional native Excel functions but VBA offers some possibilities.
HOWEVER,
The simple addition of one more column to Table2 with a very basic VLOOKUP reduces all of your problems to a SUMIF.
The formula in the new column D, row 2 is,
=VLOOKUP(E2, A:B, 2, FALSE)
The formula in I2 is,
=SUMIF(D:D, H2,F:F )
Fill each down as necessary. Sorry if that is not what you wanted to hear.
Thank you everyone that responded and reviewed this post. I have managed to resolve this using an array formula and some matrix algebra. Please note that I am not using VLOOKUP (this operator cannot be performed on arrays) nor SUMIFS as my title states.
My final formula looks like this:
{=SUM(IF([Table2.xlsx]Sheet1!SubGroup=TRANSPOSE(IF([Table1.xlsx]Sheet1!Group=G2,[Table1.xlsx]Sheet1!SubGroup,"")),[Table2.xlsx]Sheet1!DataValue))}
Very simply, I create an array variable that compares the Group being evaluated (e.g. cell G2) with the Groups column for Table 1 and outputs the corresponding matching SubGroups. This results in an array with as many rows as Table 1 had (N) and 1 column: Nx1. I then transpose that array (1xN) and compare it to the SubGroups column (Mx1, M being the number of rows in Table 2) and output the DataValues column for the rows that have a corresponding SubGroup (MxN). Then I perform a sum of the whole array to return a single value.
Notice that as I didn't include a value_if_false output return on either IF operators, it will just populate with FALSE in the arrays were the conditions are not met. This does not matter though for the final result. In the first IF, FALSE will not match the SubGroups so will be ignored. For the second all values FALSE passed to SUM will be calculated as 0. The more complicated question is that it grows the amount of memory required to process as we are not filtering to just have the values we want.
For this application I decided against filtering the subarray as the trade-off in resource utilization was acceptable. If the data sets were any bigger though, I would definitely try doing it. Another concern was that I did not understand fully the filtering logic that I was using based on http://exceltactics.com/make-filtered-list-sub-arrays-excel-using-small/ so decided to simplify. Will revisit this concept latter as I think it will work. I might have completed this solution but was missing transposing the array to compare properly so abandoned this route.
I am working on a project where I am using Excel to analyze several million data points. I've already converted my data into simple binary true and false. Now I need to sum 75,000 data points at a time and store them in a separate column. I think what I need to do is very similar to the result given to the linked question at the bottom of this post but I was wondering if someone could help me figure out how to store the sum's properly.
For example, I want to take data points B1 through B75,000 and sum them and store them in D1. Then I want to sum B75,001 through B150,000 and store them in D2 and so on.
As mentioned, the result should be in a pretty similar form to that given in the linked question, I was mostly hoping someone could clarify what numbers I need to use in order to fix my offset problems and store the numbers in the right location. Thanks in advanced for any help you can give, I appreciate it.
I want to sum every 7 rows in a worksheet and put the sum in different column & rows
Considering the comment, I edited and simplified the answer. Try this out:
=SUM(OFFSET($B$1,(ROW()-1)*75000,0,75000,1))
Edit: Heh, now I see it's the same as ZAT's comment, which was made when the question had the old ranges. :)
EXCEL - finding a match between two tables
https://drive.google.com/folderview?id=0B2WLaA0HlUBVWnlwaFRGMmdwaVU&usp=sharing - excel file
FILE : vraag.xlsm
I would like to make a dynamically solution, for searching a text pattern from one table if it is also in the text of an other table (in different columns).
(Dynamically, I mean if the are elements are added, deleted, changed)
So searching if one the elements from column 'ID_type' can be found in the text of column 'element'
!
table A [T_example] : in a column contains tekst (within maybe one
of the elements of the other table)
table B [T_rec_by_type] : contains several possible strings
edited : next seems to be a wrong approach : MATCH()
=IF(ISNA(VLOOKUP(A23;T_rec_by_type[ID_type];1;FALSE));FALSE; "File found in row " & MATCH(A23;T_rec_by_type[ID_type];0))
In the first example (exactly match, so not as search pattern), it works.
But the idea is to search in the text to find the searchpattern ... and return via VLOOKUP a value from an other column (in this stadium just ID_type).
A possible solution found in an answer online
EXCEL - Find category by searching keyword from other worksheet
https://drive.google.com/folderview?id=0B2WLaA0HlUBVWnlwaFRGMmdwaVU&usp=sharing - excel file
FILE : SearchAMatchtingStad.xlsm
In the hope to find a solution ... for my case via this answer, I tried it out but unfortunately without succes.
So what am I doing wrong?
(I tried it first with tables, columns and ...
=IFERROR(IF(INDIRECT("Sheet1!A"&MAX(IF(ISERROR(SEARCH(CONCATENATE("*";Table1[[stad 1]:[stad 3]];"*");[#shop]))+(Table1[[stad 1]:[stad 3]]="");0;ROW(Table1[[stad 1]:[stad 3]]))))=Table2[[#Headers];[antwerpen]];[#sales];"");"Not found")
to figure out my fault/problem, why it doesn't work ...
I did it just by one cell, but without luck)
= IFERROR( IF( INDIRECT("Sheet1!A" & MAX( IF( ISERROR( SEARCH("*"&Sheet1!$B$2:$D$4&"*";$B8)) + (Sheet1!$B$2:$D$4="") ; 0 ; ROW(Sheet1!$B$2:$D$4)))) = D$7;$C8; "") ; "Not found")
A small remark ENTERING AN ARRAY FORMULA: press the CTRL SHIFT and ENTER
In a way it seems that there is an issue with array formulas
So when I do a one to one 'search' it seems to work =SEARCH("*"&B2&"*";$B8)
But when I do it with an array (despite it is still an array but with "\" instead of { "genk" ; "mol" ; "leuven" ; ... }), it seems to be a problem, or not working the way I wished. =SEARCH(CONCATENATE("*";OR(Table1[[stad 1]:[stad 3]]);"*");B8)
So I give it a last try.
But with OR or without gives the same result.
And to check if it maybe a problem is with CONCATENATE, I created a simular table with the wildcard already implemented.
Maybe ONE important thing, I forget to say there is always a space in front of the ID_TYPE.
And the ID_TYPE itself followed by a number (of maximum 3 characters) and a space.
You may have to change ; to , and , to . according to your local.
#Tom Sharpe
Thanks for your answer, but when I tried it out, it doesn't work.
Maybe ONE important thing, I forget to say there is always a space in front of the ID_TYPE.
And the ID_TYPE itself followed by a number (of maximum 3 characters) and a space.
I used 0 - in case default, not found.
Correct Tom, if I use '=FORMULATEXT(B35)', I see the formula is surrouded by { and }.
So I don't understand what I'm doing wrong.
And it worked fine at your place, you did it with my spreadsheet? Strange.
I uploaded the file changed as "vraag2.xlsm"
#user3616725
Maybe ONE important thing, I forget to say there is always a space in front of the ID_TYPE.
And the ID_TYPE itself followed by a number (of maximum 3 characters) and a space.
put new file in the shared folder : vraag2.xlsm
Here's another solution without using Regex. It tests each element in the first column of the table in A1:A7 (ID_type) using FIND to see if it is a substring of the element in A25 and below. The row numbers of any matching cells in a1:a7 are stored in an array. Because you want the first match, it uses MIN to find the lowest row number. If there is no match, it stores a reference to a cell which is outside the table, i.e. A8. I'm using FIND because I don't want to match lowercase, otherwise ... "3 spots plafond" would match with A because it has an 'a' in it.
If you enter the array formula in (say) d25 and pull it down, it will give the row number of the first matching cell in the table. If you enter the second formula in (say) e25 and pull it down, it will give the corresponding cell in another column of the table, in this case column B (type).
The first formula in structured form is:-
=MIN(IF(ISERROR(FIND(T_rec_by_type[[#Data],[ID_type]],A25)),ROW(A$8),ROW(T_rec_by_type[[#Data],[ID_type]])))
and the second one in structured form is
=IFERROR(INDEX(T_rec_by_type[[#All],[type]],D25),"Not found")
The formulae in ordinary notation (which I find a bit easier) are
=MIN(IF(ISERROR(FIND(A$2:A$7,A25)),ROW(A$8),ROW(A$2:A$7)))
and
=IFERROR(INDEX(B$1:B$7,D25),"Not found")
ROW(A$8) above is just a not very subtle way of getting a row number which is greater than that of any rows in the table. You could just use an arbitrary large number, or perhaps add a Totals row to the first table and use that to get the reference.
I haven't been able to work out why your vlookup didn't work with the table (it's OK if I copy the cells somewhere else), perhaps other people can comment.
using REGEX functions from MORFUNC ADDON*
I used your vraag.xlsm shhet that you linked to.
In cell C25 put: =REGEX.MID(TABLE12[[#ThisRow],[element]],MCONCAT(T_rec_by_type[ID_type],"|"),,TRUE)
this will give you the first (left-most) of the "keywords" that appears in the corresponding "element" cell.
This is almost there. but you say that the "SSR" sensor is more important than V, so that's the one that should be displayed if they both appear.
this is not pretty, but will work (if u provide more details on possible "ID_type"s and the order of things in "element" field i might be able to come up with something more elegant...) :
paste in cell D25:
=IF(REGEX.COMP(Table12[[#This Row],[element]],A$2,TRUE),A$2,IF(REGEX.COMP(Table12[[#This Row],[element]],A$3,TRUE),A$3,IF(REGEX.COMP(Table12[[#This Row],[element]],A$4,TRUE),A$4,IF(REGEX.COMP(Table12[[#This Row],[element]],A$5,TRUE),A$5,IF(REGEX.COMP(Table12[[#This Row],[element]],A$6,TRUE),A$6,IF(REGEX.COMP(Table12[[#This Row],[element]],A$7,TRUE),A$7,""))))))
copy C25 and D25 down, for the other elements
MOREFUNC ADDON
Morefunc Addon is a free library of 66 new worksheet functions.
HERE is some information (by original author)
here is the last working download link I found
here is a good installation walk-through video
My apologies if this has already been answered in some form; it’s difficult to come up with the correct wording to do a proper search.
I have been charged with creating some basic reporting for my team and I need to create an “if-then” formula. Essentially, if Column A contains the word “Open Rate,” I want the formula to grab the associated percentage from column B (16.49%) and make an average of all the open rates on another sheet. (16.49% + 14.98% + 14.48% / 3 = 15.31%)
I would simply add all of them but the data set is ridiculously large and always growing. Also, the numbers of rows between data sets are not equal and thus a nice pattern is out of the question.
excel uses a vb type syntax
=IF(A2<>"open rate",A2,AVERAGE(Sheet2!A:A))
the above formula says if a2 is not equal to open rate, then return a2, else return the average of column A in sheet 2
Please try:
=AVERAGEIF(Sheet1!A:A,"=Open Rate",Sheet1!B:B)
with your first sheet name adjusted to suit, if necessary.
Edit re supplementary
Google Doc does not at the moment have a function =AVERAGEIF, however it does have the building blocks for it. Average (as in arithmetic mean) may be calculated as the sum of the values in a dataset divided by the count of all the individual items in the dataset:
=sumIF(Sheet1!A:A;"=Open Rate";Sheet1!B:B)/countIF(Sheet1!A:A;"=Open Rate")
Google Doc does have the =AVERAGE function and this may be more suitable than the above.