Excel advanced lookup/reference formula required - excel

I am trying to lookup a value in one sheet based on three criteria. The lookup formula resides in the Operational Data sheet which contains data from the machine which reports every ten minutes and has a structure similar to the table below (simplified for the sake of simplification)
DateTime Status => ShouldBe
01/12/2010 01:00:01 ? 16
01/12/2010 02:00:01 ? 16
01/12/2010 03:00:01 ? 16
01/12/2010 04:00:01 ? 0
01/12/2010 05:00:01 ? 0
01/12/2010 06:00:01 ? 0
...
08/12/2010 07:00:01 ? 204
The Status column should reference the Status Data sheet which contains data of the machine's operating status. This only reports change in the machine's status, ie is not periodic. The Status Data sheet has a structure similar to that below (again simplified for the sake of simplification)
Error Code Start Time End Time
16 01/12/2010 00:00:01 01/12/2010 03:08:56
0 01/12/2010 03:08:56 06/12/2010 12:01:21
204 06/12/2010 12:01:21 15/12/2010 01:14:01
0 15/12/2010 01:14:01 20/12/2010 09:12:42
Any ideas?
-- edit
From a quick web search there appers to be two approaches to lookup with mulitple criteria. This first being to add another column of concatenated valeus and using VLOOKUP on a concatenated string. This is not appropriate because I am trying to search based on < and > (less/greater then) on the date columns.
I couldn't figure out how to use MATCH for this because the third argument defines weather the LOOKUP is a a greater/less than and I can't combine the two.
For example:
'Operation Data'!DateTime > 'Status Data'!StartTime and 'Operation Data'!DateTime < 'Status Data'!EndTime

If on sheet 'Status' Error codes are in Column A and Start time in Column B
on sheet 'Operational Data' DateTime is in column A
Formula is, for a cell in row 2
INDEX('Status'!$A:$A,MATCH(A2,'Status'!$B:$B,1))
Assumes data in sheet 'Status' is sorted ascending on Start Time

I think you have a couple of options:
1) You add a new column which is a concatenation of your 3 lookup criteria and do your lookup based on this.
2) The second option is an INDEX MATCH array formula, there is an example on here: http://www.ozgrid.com/forum/showthread.php?t=46692&page=1

Related

Way to find value in a date range Excell

I have Start date + time and End date + time in table 1, then i have a range of dates and values in table 2. what i want is to find the highest value from table 2 that happened in the date range from table 1.
For example in table 1:
start date 12/30/2020 08:03 ; end date 12/31/2020 17:26
in table 2 is:
12/30/2020 08:00 1145
12/30/2020 09:00 2145
12/30/2020 10:00 3912
12/30/2020 08:00 1472
and so on. so in the row of table 1 i want to see the number 3912
Suppose both of your tables are structured reference table as shown below:
You can use either of the following formula to return the desired value:
=MAX((Table2[Date]>=Table1[#[Start Date]])*(Table2[Date]<=Table1[#[End Date]])*Table2[Value])
This one is using MAXIFS as suggested by Nicholas Hunter in the comment section:
=MAXIFS(Table2[Value],Table2[Date],">="&Table1[#[Start Date]],Table2[Date],"<="&Table1[#[End Date]])
Assuming table 1 = A1-B10 and table 2 is in D1-10,
try making another column (lets say F1-10) with the following: =IF(And(D1<B1,D1>A1),D1,0)
and in whatever cell you want the highest Date, put =Large(F1-10)
Make sure that the final cell has "Date" format, otherwise it will look like a weird number. if you want to look at the intermediary steps, do the same for F1-10.

Classify Excel Filter

My Excels filters are not showing values as asc neither desc.
As we can see the First column filter is:
0
1
10
11
12
And should be:
0
1
2
3
...
The Second Column is:
01/07/2019
01/08/2019
02/07/2019
02/08/2019
And should be:
01/07/2019
02/07/2019
01/08/2019
02/08/2019
Does anyone knows how to fix it?
It cannot be fixed as long as your values are text values (therefore it says "Filtros de Texto"). If you transfer the values in numbers or dates it will be fine. Whith dates, you will even get the selection of certain months and years!
You can transfer the values by
editing every single value (F2 - Enter - F2 - Enter - ...)
taking them to another column with the Function VALUE(A2)
specify the correct format when importing from CSV or Text files

Indexing Groups of Data

I have 10,000+ row of values which need to be indexed with a numerical value which increases by 1 every 56 rows - for example:
Rows Index Value
1-56 1
57-112 2
113-168 3
169-224 4
Any ideas?
Thanks! :-)
If your data starts in Row #2 like your example implies, then try this formula in Row #2 the column where you want your "index number":
=INT((ROW()-1)/56)+1
The 1 in the middle is "how many rows to skip at the top", and the 56 is obviously the size of each group.
More Information:
Office Support : ROW Function (Excel)
Office Support : INT Function (Excel)

Excel sumifs until a new value in column

I have some data that looks like:
Day Result
1-Nov 1
0
1
2-Nov 1
3-Nov 0
0
4-Nov 1
There are other columns with data. I only have the date once as the data is displayed graphically in a time series.
Now I'd like to setup a summary table that aggregates each day. I cannot use sumifs because the date is only in the data once.
How could I write a calculation such that excel sees a2 has a value so sums b2,b3,...bi until ai has a value.
Preferably not vba, never learned it and want to do this in excel rather than R or Python.
EDIT:
I am specifically looking at how to do calculations on the result column grouped by each date. Blank cells should be considered the same date. So when excel sees 1-Nov it then does a calculation (i've said sum but any we can extend to) on 1,0,1 and then stops and a new calculation is done for Nov-2.
IMHO, instead of using a table like this:
Day Result
01/nov 1
0
1
02/nov 1
03/nov 0
0
04/nov 1
You should populate the "Day" column and use a pivot table to summarize the results.
I.e.:
Day Result
01/nov 1
01/nov 0
01/nov 1
02/nov 1
03/nov 0
03/nov 0
04/nov 1
And the pivot table:

Is there a way to make Lookup always return the first encountered match in a column?

I have user retention data that looks like this:
signup_date days retention
2/24/13 0 1
2/23/13 0 1
2/23/13 1 0.4855
2/22/13 0 1
2/22/13 1 0.4727
2/22/13 2 0.3647
2/21/13 0 1
2/21/13 1 0.5135
2/21/13 2 0.3879
2/21/13 3 0.3463
2/20/13 0 1
2/20/13 1 0.5402
2/20/13 2 0.4166
2/20/13 3 0.3615
2/20/13 4 0.3203
2/19/13 0 1
2/19/13 1 0.5317
2/19/13 2 0.4348
2/19/13 3 0.366
2/19/13 4 0.3077
The second column ("days") represents days elapsed since the signup date and the retention is based on that day and the signup_date (since retention can change over time). I need to make projections going forward, and unfortunately for me (since I would prefer to do this programmatically), my boss wants them in Excel. So I'm trying to use the Lookup() function to find the most recent value in the retention column that would match the "days" elapsed from a certain signup date.
Anyway, that's all prelude to the question, which is that right now if I enter the formula:
=lookup(1,B:B,C:C)
where B:B is "days" and C:C is retention, it doesn't necessarily return the first (i.e. most recent) retention value in the data set. For example, in this case, I need the cell to be 0.4855, but the formula may give me 0.4727 (which is the second "days=1" row). Is there any way to configure it to do this or is there another function that will do what I need?
Instead of using LOOKUP, use the VLOOKUP function - it has another parameter that specifies that the data is not in order:
=VLOOKUP(1,$B:$C,2,0)
This will return you the entry in the second column of your range B:B where "1" is found in the first column of your range. Do not forget the 0 at the end, as this tells Excel to search row by row (vs. a binary search as LOOKUPor omitting the parameter would do).
Alternative:
VLOOKUPis the simple formula and default for those situation. The even better, as more flexible way is to use INDEX/MATCH:
=INDEX($C:$C,MATCH(1,$B:$B,0))
This will do exactly the same, just that you have a bit more flexibility and don't need to include the "second column from the lookup data"...
HTH!

Resources