Excel formula to get last entry in a row - excel

I have a sheet where each row begins with a string identifier, followed by a series of values for each week since the sheet was created:
XXX 15 20 25
YYY 11 15 19
ZZZ 18 22 22
On another sheet I would like to have some of the string identifiers from the first page (not all), and only the latest value for that item:
XXX 25
ZZZ 22
I actually want multiple sheets of the second kind, with each string id possible appearing on more than one sheet.
I can't use VBA as this has to be viewed (and values added and altered) on my Windows Phone 7 (I do not believe the mobile version of excel supports VBA, but correct me if I'm wrong). Is there a formula that's able to do this?

The value of the last non-blank cell in ROW range
=LOOKUP(2,1/(A1:M1<>""),A1:M1)
on your master sheet you should designate a hidden column like ZZ to contain the formula: =LOOKUP(2,1/(A1:ZY1<>""),A1:ZY1) this will put in column ZZ all the LAST values of that specific row
on all of the other sheets that depend on your master, you can use a vlookup to retrieve the information in ZZ from the master sheet

Related

Create UI to filter and aggregate in Excel

I have a long excel containing dates and many value columns. I would want to create a dynamic filter where the user can input a date range in two cells and the values from each column will be filtered by the date range and an aggregated value calculated from the filtered values will be shown.
For example in the table:
Row year weight_pounds gestation_weeks
1 2005 6.0627122049999995 38
2 2006 7.12534030784 40
3 2007 7.4406013425 39
4 2008 3.30032006214 43
5 2009 7.1099079495 41
6 2010 7.31273323054 40
7 2010 9.31232594688 42
I want to filter by year 2007 to 2009 and show the average on both value columns in the sheet.
How can I approach this in excel? I have no experience to VBA but I am open to VBA if it is required.
Define a helper column that tests whether the row is within the required date range and filter based on that column.
Suppose the start date is in X1 and end date is in X2. And suppose your main data table starts with the heading Row in A1.
Then the formula in D2 might be something like =and(B2>=X1,B2<=X2)
Copy that formula down the whole list to give a column with TRUE and FALSE values
Turn on filters on the heading row
Select just TRUE in the helper column
For the average you can either use =SUBTOTAL(101,C:C) (the 101 parameter says to give the average of the rows that are still visible) or =AVERAGEIFS(C:C,B:B,">="&X1,B:B,"<="&X2) (which works regardless of how the main data table has been filtered.

MS Excel - Get multiple results based on same values in a column

Basically my problem is that I have an integer (1) in one cell in excel, and I want to show all the rows from an another worksheet, where the first column has the same integer (1).
Example of Worksheet 2
Slot Data1 Data2
1 15 124
2 20 23
1 89 523
3 20 23
Now I want to scan the Slot column for 1 and then populate the cells with the values under Data1.
I have tried to work with functions INDEX and MATCH, but the problem is it gives back only the first row where the Slot column has 1
My function is: =INDEX('Worksheet2'!DATA1:DATA1;(MATCH(1;'Worksheet2'!SLOT:SLOT)))
This function search in Worksheet 2's SLOT column for the integer 1 and gives back the value of DATA1 from the same row.
In this case we've got back 15 as result. The only problem is, this function only finds the first row with the value 1 in SLOT's column, but I want to get back all of the rows having 1 as SLOT.
How can I get 15 also 89 as result - maybe in another cell in Worksheet 1? Do I need to use VBA on this?
(I'm using Excel 2013)
You will have to transcribe this to your named ranges with worksheet scope.
=IFERROR(INDEX(DATA1, SMALL(INDEX(ROW(SLOT)+(SLOT<>1)*1E+99, , ), ROW(1:1))), "")
Fill down for the second, third, etc. matches.

Vllookup, match, index

I am trying to compare data from one sheet to another. Address and its ID.
Both sheets have Address and ID. ID can be repetitive.
Sheet 1 Sheet 2
Address ID Address ID
23 1 22 1
45 1 45 1
23 2 23 2
45 2 45 3
I want to check whether the data address & ID on sheet 1 appear on Sheet 2 thus making a new row with return Yes or No on sheet 1 for every column.
This can be done very quickly with an array formula.
Picture of ranges and result shows the data on the same sheet so that it is easier to see what is going on. Pretend Sheet1 is on the left and Sheet2 is on the right.
Formula in cell D3 is an array formula (enter with CTRL+SHIFT+ENTER) and then copied down to fill.
=(B3=$F$3:$F$6)*(C3=$G$3:$G$6)
This formula will simple return a 0 or 1 for no match/match. You can wrap it in an IF if you want text instead. It is simply checking that the relevant values match for both columns in both "sheets".

How to fill up data table from different sheet basing on column value?

I am trying to incorporate such a workbook that contains large datatable in one sheet and different input sheet. As per header column's cell value, I want to fill up the database from input sheet. It is as below:
Sheet Database Sheet Input
Date Data Date Data
. 12 May 14 45
.
.
.
10 May 14 16
11 May 14 85
12 May 14 45
13 May 14
14 May 14
15 May 14
.
.
.
.
While I am using the Data Column Cell's formula as an example in Cell B2 of "Sheet Database" sheet like:
IF(A2='Sheet Input'!$A$2,'Sheet Input'!$B$2)
Only the cell beside the date that matches with the input sheet, gets the value from the input sheet. The scenario is as follows:
Sheet Database Sheet Input
Date Data Date Data
. 12 May 14 45
.
.
.
10 May 14 FALSE
11 May 14 FALSE
12 May 14 45
13 May 14 FALSE
14 May 14 FALSE
15 May 14 FALSE
.
.
.
.
But I want to persist the value once available. That means, I want to enter data from Input sheet and the database sheet should keep the value once it was entered. Input sheet may vary to data, but the previous data should be in the database sheet.
I know very well that this code will not be able to achieve my aim.
I am brainstorming, but could not find any way to do so. Can anybody please help me in this regard?
Note: I shall not use macro/VB. I solely want to be dependent on the built in functions of Excel.
If I understand you correctly, you're looking for a simple VLOOKUP. Something like the following formula in the data column of your Sheet Input sheet should do the trick (Assuming the data column is column B and the Date column is column A and Date and Data are headers in row 1):
=VLOOKUP(A2,'Sheet Database'!A:B,2,FALSE)
This function is essentially looking for the value in cell A2 from Sheet Input in column A of Sheet Database and then returning the value in column B that corresponds to the value it was searching for.
If you want the cell with the formula to be blank in the event that the value is not found in the database, you can wrap your function with an IFERROR function as follows
=IFERROR(VLOOKUP(A2,'Sheet Database'!A:B,2,FALSE),"")
Good luck.

Transfer data from one worksheet to the next based on cell values

I had trouble titling this, and I think it is better explained with examples. I am not an extremely experienced excel user, but was asked to figure this out.
Worksheet 1 (delivered by software) is formatted like this:
12/17/2013
Hour Delivered
00.00-00.59
Employee 1 18
Employee 2 17
Total For Hour 35
01.00-01.59
Employee 1 18
Employee 2 17
Employee 3 12
Total For Hour 47
... etc until hours 24.00-24.59
The number of employees in the group per hour is different each day, so i don't think that I can just simply reference the cells.
The worksheets that I want to transfer the data from worksheet 1 to are based on date, so there is one for each day. (12/17 worksheet, 12/18 worksheet, etc...)
And this is the format of the date worksheets:
Employee 00.00-00.59 | 01.00-01.59 | etc. until hours 24.00-24.59
Employee 1 18 18
Employee 2 17 17
Employee 3 12
Employee 4
Employee 5
So basically I need the data from worksheet 1 transferred over to the individual date worksheets. I believe, the amount of employees being different for each hour/day makes this difficult. Does anyone here have any ideas of how this can be accomplished?
Also, if there are any questions, please let me know.
This should be possible without any VB in two steps. First step is to add further columns to Worksheet 1 that normalise the data. Second step is to create a pivot table using that normalised data.
By "normalise" I mean add columns in Worksheet 1 for Date, Hour, Employee and Delivered using formulae that copy values from your existing columns A and B. Let me know if you need more help with that.
Edit: adding details ...
Suppose Worksheet 1 has the values you indicated in column A and B, and that you want Hour in column D. Suppose row 1 just contains column headings. Leave row 2 totally empty. The formula in col D needs to say "If the value in col A looks like an hour, then copy it, otherwise repeat the hour from the line above." A simple way to determine if a row in Worksheet 1 is an Hour is to look for a decimal point in position 3. So put =IF(MID(A3,3,1)=".",A3,D2) in cell D3 and copy that formula down.
I'm sure you can construct a similar formula for the Date, Employee and Delivered columns.
Maybe add a condition to the formulae to say "If the value in col A starts with 'Total' then leave the cell empty".
If there aren't a lot of data and the setup is exactly how you've displayed them above, a simple formula can solve this.
Assuming that my raw export is in sheet Base, cell A1 and my intended output starts in sheet Output, cell A1, you can use this formula on cell B2:
=IF(INDEX(Base!$A:$A,MATCH(B$1,Base!$A:$A,0)+ROW(1:1),0)=$A2,OFFSET(INDEX(Base!$A:$A,MATCH(B$1,Base!$A:$A,0)+ROW(1:1),0),0,1),0)
The premise is simple. It locates the correct hour using INDEX + MATCH, then OFFSETs it by the correct number of ROWs. This is assuming, of course, that your employees are in the same location under every hour (ie Employee 1 is always one (1) row below the hour, Employee 2 is always two (2) rows below, etc). We also add a check if the employee name matches so that it will return 0 if the employee is not there.
Here are some screencaps:
Sample data:
Output:
Of course, this is just the basic premise. If you have multiple dates in a sheet, it's just a matter of manipulating this formula further. Off the top of my head, locating the correct date and adding the correct offset can also work.
Let us know if this helps or if a VBA or the Pivot option seems best.

Resources