Look up Cell data based on Month header in table with two cells as reference - excel

Some days ago i got help from Scott Craner with an formula for a 3D index match which works great.
I have tried expanding on it without any results, hopefully you can point out what i'm doing wrong.
Output list
Group Division Input Verification Differance
G1 1 120 123 =Sum([#[Input]]-[#[Verification])
G2 2 76 110 =Sum([#[Input]]-[#[Verification])
G3 3 110 90 =Sum([#[Input]]-[#[Verification])
G4 4 34 53 =Sum([#[Input]]-[#[Verification])
Data list
Group Division Year Jan Feb Mar Apr
G1 1 2017 123 95 80
G2 2 2017 110 85 75
G3 3 2017 90 80 70
G4 4 2017 53 53 46
Following code is the one im trying to use, using only Group as a lookup i get a value
=INDEX(DataList,MATCH([#Group]:[#Division],DataList[Group]:DataList[Division],0),MATCH(TEXT($A$1,"mmm"),DataList[#Headers],0))
I have tried different variations,
Binding the results together with an &,
Tried binding just one result with & and the other one with a simple :
nothing has produced a good result in some cases i get a result, in others i do not get anything.
If i only use Group as a lookup term it's not an issue, it returns the correct value, but I'm trying to Index match two cells with two other cells.
I have evaluated the code and it does not return a value and I do not know what i'm doing incorrectly

Related

Look up Cell data based on Month header in table

i'm trying to create a small spreadsheet for data verification.
Below i have created two tables Table 1 and Table 2.
What i am trying to find is a simple =Index Match or similar to check for Current month then copy that value to respective Group row under verification.
Problem is that the months are a header row and i have no idea how to check a header row for correct month then output the values in the cells below it to each corresponding group in the output list.
So to put it in programming terms this is what im looking for
If A2=Table2[Header] then c8=C4 else table[header] + step right
A2 contains todays Date (=today()) and Header has the shorten Month names as Jan Feb Mar and so on.
Something similar as above, i don't know if i'm making it harder for me then it really should be. I'm working with Excel 2013.
Output list
Group Input Verification Differance
G1 120 123 =Sum([#[Input]]-[#[Verification])
G2 76 110 =Sum([#[Input]]-[#[Verification])
G3 110 90 =Sum([#[Input]]-[#[Verification])
G4 34 53 =Sum([#[Input]]-[#[Verification])
Data list
Group Year Jan Feb Mar Apr
G1 2017 123 95 80
G2 2017 110 85 75
G3 2017 90 80 70
G4 2017 53 53 46
Regards
Johan
You would use a second match to find the correct column:
=INDEX(DataList,MATCH([#Group],DataList[Group],0),MATCH(TEXT($A$1,"mmm"),DataList[#Headers],0))

excel incrementation by consecutive numbers

I have a form, thanks to user JamTay317, That lists data depending on folder number (bold number in form). I need to copy it for all 1500 folders (about 400 pages)
Form is divided on 4 labels on a page for easier printing
form overview
Form get it's folder number (nr teczki) from list with all folders from another sheet called "lista teczek":
list of folders
For first 4 folder numbers I use formula:
A2='lista teczek'!A1
J2='lista teczek'!A2
A21='lista teczek'!A3
J21='lista teczek'!A4
When I copy whole page underneath it increments by 36 (number of rows between)
A38='lista teczek'!A37
J38='lista teczek'!A38
A57='lista teczek'!A39
J38='lista teczek'!A40
Instead of A5, A6, etc.
Is there any way to override excel's incrementation to force it to use consecutive numbers? Or at least formula which will make it easier to follow folders list?
So I would use offset() to get the correct position
=A2=OFFSET('lista teczek'!$A$1;ROW(A1)-INT(ROW(A1)/36)*36+4*INT(ROW(A1)/36)-1;0)
So this will offset from A1 in the list sheet.
Below are row numbers a resultant lookup row numbers
Note the formula I used in the offset has an extra "-1" as this is an OFFSET so to get 1 from 1 we need to offset by 0
1 1
2 2
3 3
4 4
37 5
38 6
39 7
40 8
73 9
74 10
75 11
76 12
109 13
110 14
111 15
112 16
145 17
146 18
147 19
----LOGIC--- (edit)
So the idea is that you work out the occurrence you are on. Int(row()/36) gives us this. For example
int(1/36)=0
Int(363/36)=10
First part gives us the offset from the start of the occurrence
3-int(3/36)*36=3
378-Int(363/36)*36=3
Second part give the total of the previous occurrence
4*int(3/36)=0
4*Int(363/36)*36=40
So you need to change the 36 to the gap between the occurrences and the 4 to the length of occurrences Not sure if that helps to explain

Find all rows that contains 4 specific values?

I am using excel and I have a table of numbers with 6 columns from A to F and more than 1000 rows. For example, from my table,
4 17 37 38 47 53
8 43 54 55 56 60
4 18 21 25 38 57
15 25 37 38 58 59
4 16 19 20 27 43
18 32 47 50 54 56
i want to find if there is at least a row (it must be a row!) that contains the numbers 16 19 20 27. From this example, there is a match, but i don't know how to make a search or formula using four diferent numbers.
I feel like I need to use the match function but can't quite figure it out and I'm not sure about it. Does anyone know how to do this?
Thanks!
This should work:
=IF(AND(OR(A1=16,B1=16,C1=16,D1=16,E1=16,F1=16),OR(A1=19,B1=19,C1=19,D1=19,E1=19,F1=19),OR(A1=20,B1=20,C1=20,D1=20,E1=20,F1=20),OR(A1=27,B1=27,C1=27,D1=27,E1=27,F1=27)),"Yes","No")
Put it in a new column in the table. It will return a Yes if the row contains all 4 values, and a No otherwise. You can then filter the new column of Yes/No to search for a row with Yes
I put the four values you are seeking in I1:L1 and the array of data to be searched in A1:F#. Then in column G create a helper column that concatenates A:F into a delimited string. The formula in G1 is:
=":"&A1&":"&B1&":"&C1&":"&D1&":"&E1&":"&F1&":"
where I've used ":" for the delimiter (you can use any char that's not in your data).
The result in G1 is:
:4:17:37:38:47:53:
Now in H1 use this formula to search:
=NOT(ISERR(FIND(":"&$I$1&":",G1)*FIND(":"&$J$1&":",G1)*FIND(":"&$K$1&":",G1)*FIND(":"&$L$1&":",G1)))
Each FIND will return an INT if the value (with leading and trailing delimiters) is found and #VALUE! otherwise. So the product will be an INT if all values are found and #VALUE! otherwise. Wrapping the FINDs inside an ISERR makes the result prettier (TRUE/FALSE instead of #VALUE!), and inverting with NOT returns TRUE when all 4 values are found and FALSE otherwise.
Hope that helps.
Here's another way --- more elegant (no helper column). As before, I put the four values you are seeking in I1:L1 and the array of data to be searched in A1:F#. Then in column G use this ARRAY formula (CTRL-SHIFT-ENTER):
=NOT(OR(PRODUCT(A1:F1-$I$1)<>0,PRODUCT(A1:F1-$J$1)<>0,PRODUCT(A1:F1-$K$1)<>0,PRODUCT(A1:F1-$L$1)<>0))
Each PRODUCT term checks for the existence of one value and returns 0 when the value is found and a non-zero value otherwise. The results of each of the four PRODUCT terms is tested with <>0 which will return TRUE if a value is not found. Then OR with return TRUE if one or more values are not found and FALSE if all are found. That result is wrapped in a NOT so that the function result is TRUE when all four values are found.

Return max index value in vlookup

I'm trying to pair a vlookup with a max function. For some reason it only returns #ref every time I try to use it though.
My sheet looks like this:
A - B - C - D - E - F - G
1...
5 - Prod5 id1 $100 $125 $155 $110 $150
6...
A:G is named buyAverages
C:G is named buyAveragesPrices
What I want to do is have a vlookup go and find a value in Col A and then return the highest value in that Col. So example:
A - B
1 - Prod5 *return highest price for Prod5
What I wrote in B1, which failed:
VLOOKUP(A1,buyAverages,MAX(buyAveragesPrices))
So how do I achieve this lookup? Everything I have found is how to use MAX for the lookup value, but nothing to use max on the returned index.
Try this
=MAX(IF(A:A="Prod1",C:G))
This is an Array Formula. i.e you have to press Ctrl+Shift+Enter
If there's only one instance of each Product then you can use INDEX/MATCH like this
=MAX(INDEX(C2:G100,MATCH("Prod 1",A2:A100,0),0))
Longer than Sid's suggestion but doesn't need CSE and might be more efficient if you only have a single match
If you have that formula in Z2, for example, you can use this version to get the location from row 1
=INDEX(C1:G1,MATCH(Z2,INDEX(C2:G100,MATCH("Prod 1",A2:A100,0),0),0))
You can have all in one cell using Vlookup and Max with a nested formula. For example at the top of the page:
A1 = Select the name of the product you want to find the max
A2= MAX(BUSCARV($A$1;$A$3:$F$11;3;FALSO);BUSCARV($A$1;$A$3:$F$11;4;FALSO)
;BUSCARV($A$1;$A$3:$F$11;5;FALSO);BUSCARV($A$1;$A$3:$F$11;6;FALSO))
It's long but you only have to type it once. With this formula we get all the different amounts in each column and then we ask for the maximum. It works if all the products are different. Change the name of the product and you'll find the MAX in the table.
Example Prod8
Prod8 41 ; If we change and you select in A1 Prod4 you'll
get 70 and so on..
Prod1 id1 100 125 155 110
Prod2 50 25 20 75
Prod3 60 65 15 90
Prod4 70 12 50 43
Prod5 100 200 80 25
Prod6 20 28 40 40
Prod7 14 43 60 80
Prod8 22 33 15 41
Prod9 65 48 50 70
Select your range accordingly.
You also could include in A1 a match code to select the name of your products..

Using pre-specified formulas elsewhere in Excel

I am trying to use pre-specified formulas in excel that can simply be referenced and used anywhere in the workbook, without using VBA. The following example illustrates how I wish this to work.
In the following example, the Forumla Specs section lists various functions we would like to use elsewhere in the workbook
The Formula Use section shows how we would like to use them. How would I call the function in the specs area to calculate the calc1 column (and calc2, calc3, etc.) across the variables d1-d4 using the formula specified in Formula Specs for calc1? I would like to use a generic formula that we can use universally to only depend on the column heading (i.e calc1, calc2, etc)?
We have tried using range names, index function, vlookups and various combinations of these to try and achieve this fete, but with no success.
Example
Formula Specs
Calculation Function
calc1 sum(d1,d2,d3,d4)
calc2 sum(d2,d3)
calc3 100*(d4/d3)
Formula Use
obs d1 d2 d3 d4 calc1 calc2 calc3
obs1 24 45 14 41 124 59 292.8571429
obs2 19 28 47 34 128
obs3 29 32 20 24 105
obs4 40 43 28 12 123
obs5 39 16 11 40 106
obs6 17 14 38 14 83
obs7 47 38 26 24 135
obs8 31 25 46 15 117
obs9 25 15 48 11 99
obs10 30 35 32 30 127
obs11 41 43 18 15 117
obs12 10 34 30 47 121
obs13 44 23 10 22 99
Please help!
This is a duplicate of Getting formula of another cell in target cell
Short answer is that you can't without VBA. Also, I don't know why you are so adament about not using UDFs as they are not very complicated to learn about if you are not familiar with VBA.
You could use Named Ranges to achieve this:
Select the first cell you want calc1 to be used in
Create a new named range called calc1
Set its Refers To value to =sum(d1,d2,d3,d4)
Put the formula =calc1 into the cell
Now, when you enter the formula =calc1 into another cell, it will sum cells relative to the new cell.
If you don't want it to be relative, use absolute references in the named range, eg =Sum($D1,$D2)
Tried and tested on Excel 2010

Resources