Three Dimension Vlookup - excel

I have a master table with the following structure in excel :
How can I convert it as shown in the second picture by using the vlookup function? (function in yellow cells).
Three keys involved now: Daytime, User and Data Type (ADP_ERQ, ADP_SO)
Note: Column headers (Daytime, User, ADP_ERQ, ADP_SO) in the second picture are fixed.

Try this in C17 then fill right and down.
=INDEX($A$3:$Z$12, MATCH($A17, $A$3:$A$12, 0), AGGREGATE(15, 7, (COLUMN(1:1)+MATCH($B17, $1:$1, 0)-2)/($2:$2=C$16), 1))

For cell C17: IF(B17="USER_A",VLookup(A17,A3:C12,2,0),VLookup(A17,A3:E12,4,0))
For cell D17: IF(B17="USER_A",VLookup(A17,A3:C12,3,0),VLookup(A17,A3:E12,5,0))
In this formula replace A3:C12 and A3:E12 with your appropriate table range, then drag these down.

Related

Excel - get range of data between two rows

I have data in following pattern:
I want a formula to get the data between Content Start and Content End. The amount of content between the start and end is not just limited to 4 and can change.
You don't say what you want to do with this result.
I am assuming you can code the column in which your data is located.
The formula below will return those values as an array. e.g. with your data, the formula will return {1;2;3;4}
The values could be numeric or text.
How you want to handle those values is up to you.
=INDEX($A:$A,N(IF(1,ROW(INDEX($A:$A,MATCH("Content Start",$A:$A,0)+1,1):INDEX($A:$A,MATCH("Content End",$A:$A,0)-1,1)))))
EDIT: Here is an example of using that information to create a sparkline. In this example, the formula above has been wrapped in TRANSPOSE and entered as an array formula in C1:I1. The Sparkline has been entered in B1. As with most charts, Excel is ignoring the #N/A errors.
And here is an example where the sparkline is in A1 and the transposed array is somewhere else, not in view, on the worksheet:
With Worksheets("Your Sheet").Range("A:A")
Set c = .Find("Content Start", LookIn:=xlValues)
Set d = .Find("Content End", LookIn:=xlValues)
ActiveSheet.Range(Cells(c.Row + 1, c.Column), Cells(d.Row - 1, c.Column)).Select
End With
Probably multiple ways doing this, but if you prefer to do it without VBA you could use:
Formula used in B1 (allthough a bit lengthy):
{=INDEX($A$1:$A$10,SMALL((ROW($A$1:$A$10)>MATCH("Content Start",$A$1:$A$10,0))*(ROW($A$1:$A$10)<MATCH("Content End",$A$1:$A$10,0))*ROW($A$1:$A$10),SUM((ROW($A$1:$A$10)>MATCH("Content Start",$A$1:$A$10,0))*(ROW($A$1:$A$10)<MATCH("Content End",$A$1:$A$10,0)))+ROW(A3)))}
Notice it's an array formula entered through CtrlShiftEnter
Drag down....

Excel: Use Cell Range which is saved in a cell for completing a formula in another cell

In the above Table i would like to use the range defined in V2 for the formula defined in E2. It should replace the green underlined part of the formula. As you can see there is already the right range in there but it is for flexibility reasons if the range changes so i don't have to change all the formulas which are in E2,F2,G2,... and so on.
The Formula:
=VLOOKUP("contract index",INDIRECT("'PURCHASING'!"&V2),2,FALSE)
Try,
=vlookup("contract index", indirect("'purchasing'!" & v2), 2, false)

Using IF Function Range in Excel

I have some problem in using If Excel function. I want to use range in excel. So when my data is in range, it will show something. I use this formula but it doesn't work "
=IF(E11=Rekap.C8:C21, VLOOKUP(Rekap.C8:C21, Master.A2:C148, 3), "")
Form that formula, if data in E11 is same like data in range C8 - C21 in Rekap sheet, it will show another data in Master sheet that in range A2-C148 column 3. How can I use range in if formula ?
A single cell like E11 cannot be compared to a range like C8:C21.
I assume that you really want to check if the value in E11 appears anywhere in the range C8:C21 and if so, perform the lookup. That can be done in several ways
=if(isnumber(match(e11,Rekap!$C$8:$C$21,0)),vlookup(E11,Master!$A$2:$C$148,false),"")
Note that I added the fourth parameter to the Vlookup. It will default to TRUE if omitted, which may return wrong results if the lookup table is not sorted.

Excel: Adding a row disrupts formula

In a spreadsheet I use for cash management tracking, I have the following formula:
=IF(D176="Cash", F175+C176, IF(D176="Transfer", F175+C176, F175))
When I add a row, I use control+D to fill in the formula from the cell above (I'm using Excel for Mac 2011). This results in the correct formula as follows:
=IF(D177="Cash", F176+C177, IF(D177="Transfer", F176+C177, F176))
However, this has the effect of changing the formula in the cell in the row below:
=IF(D178="Cash", F176+C178, IF(D178="Transfer", F176+C178, F176))
Here you can see the rows for column F are not correct: F176 should be F177.
Can anyone offer any advice to ensure that when I insert a row the formula remains intact?
Thanks.
Replace all of the references to F175 in the original formula (the one if row 176) with INDEX(F:F, ROW()-1).
=IF(D176="Cash", INDEX(F:F, ROW()-1)+C176, IF(D176="Transfer", INDEX(F:F, ROW()-1)+C176, INDEX(F:F, ROW()-1)))
'or better as
=INDEX(F:F, ROW()-1)+(OR(D176={"Cash", "Transfer"}*C176)

extract the unique items

Col A,Col B,Col C
Test1,Test1,Test3
Test2,Test1,Test3
Is there a way to go thru all cells and pick out the unique values and place them in a new column or something?
Most of the answers on Getting unique values in Excel by using formulas only only work for values in a single column.
For a solution that works for values in multiple rows and columns, I found the following formula very useful, from http://www.get-digital-help.com/2009/03/16/unique-values-from-multiple-columns-using-array-formulas/
Oscar at get-digital.help.com even goes through it step-by-step and with a visualized example.
1) Give the range of values the label tbl_text
2) Apply the following array formula with CTRL + SHIFT + ENTER, to cell B13 in this case. Change $B$12:B12 to refer to the cell above the cell you enter this formula into.
=INDEX(tbl_text, MIN(IF(COUNTIF($B$12:B12, tbl_text)=0, ROW(tbl_text)-MIN(ROW(tbl_text))+1)), MATCH(0, COUNTIF($B$12:B12, INDEX(tbl_text, MIN(IF(COUNTIF($B$12:B12, tbl_text)=0, ROW(tbl_text)-MIN(ROW(tbl_text))+1)), , 1)), 0), 1)
3) Copy/drag down until you get N/A's.
If you are using Excel 2007 at least, then you can just use Remove Duplicates function from Data tab.
Otherwise I think a little bit of VBA fairy dust sprinkling is in order. I can mash up a quick VBA script if you need it.

Resources