Here's what I'm trying to do with no success.
I have 2 sheets in a workbook. Format and TC.
Format looks something like this:
And TC looks something like this
I want to add after the last column in Format another column where to add the values that are in the 10th column of the TC value. That if the 2nd columns in both are the same.
This is how I tried to do it and it seems it doesn't work and I really don't know why since I'm an absolute beginer with VLOOKUP.
=IF(VLOOKUP(B2;TC!B:B;TC!V:V;FALSE)= "Montaj (Montage)"; "here I want to select the time and I don't know how…"; "VALUE NOT FOUND")
To explain it better... if the value of one cell in column 2(B) in the Format sheet is found in TC sheet in column 2(or B) then if the value of the 4th column (V) is "Montaj (Montage)" I want to put the value in the 10th column (235 in the example).
Thanks a lot for your help!
FINAL UPDATE: Added explanation.
What you need is SUMIFS. I fixed this to match your comment below.
=SUMIFS(TC!Z:Z,TC!B:B,Format!B2,TC!J:J,"Montaj (Montage)")
This will look in the B column in the TC sheet and look for the value in B2 of the Format sheet. If it finds it, AND it finds "Montaj (Montage)" in the same row in the J column, then it will return(sum if there are more than one match) value in the SAME ROW in the J column.
SUMIF is really convenient for summing conditions like this. If you only have 1 condition, you can use SUMIF. VLookup is similar, but it just returns a single value, it doesn't do anything with it.
Here is some helpful info on how SUMIFS works: http://office.microsoft.com/en-us/excel-help/sumifs-function-HA010047504.aspx
Related
I'm goofing a bit on the syntax here.
But in most basic terms, if sheet 'CT', column B has a corresponding lookup value in column B of sheet 'CT WKSHT' AND column K of 'CT WKSHT' is N/A (this cell is a formula that will not always have a value) then I want to populate a 1 else a 0.
The formula below is sort of conceptually what I'm trying to do, but I'm not doing this right clearly.
Please help if you can, as I get stuck when I think about getting vlookups to have additional conditions on them.
=IFERROR(VLOOKUP(CT!B4,'CT WKSHT'!B8:K8,10,FALSE),1,"")
Why are you even working with VLookup()? If I read your formula, it reads like:
Look for a value in column B and if you find it, return the value of column K.
If the lookup did not work, then show 1
If the lookup did work, then show and empty string
Why do you want to return value of column K if you overwrite it with an empty string anyway?
I would advise you the following formula:
=IFERROR(VLOOKUP(CT!B4,'CT WKSHT'!B8:K8,10,FALSE),1)
Is this better?
Also, you are looking for that value just on row 8, why not for the whole range:
=IFERROR(VLOOKUP(CT!B4,'CT WKSHT'!B:K,10,FALSE),1
This should do it. It combines a normal IF statement with ISERROR. ISERROR simply returns True or False depending on the result of the VLOOKUP.
=IF(ISERROR(VLOOKUP(DCTM!B4,'DCTM WKSHT'!B:K,10,FALSE)),1,0)
I'm having an issue with INDEX + MATCH combination:
=INDEX(ALL!$C$1:$I$1,MATCH(TRUE,ALL!C2:I2<>0,0))
At the moment the aforementioned formula does this job to an extent, where if it finds <>0 value in a row it will return header from this specific column. The issue is that the ROW (as above C2:I2) needs to be specified.
I need to vlookup values in the column "A" in sheet "ALL" and based on that, look at corresponding rows between C:I and if the value in that specific row is <>0 then return heading value.
So, in green I would need a formula to pick up numbers from "Data Source" headings, based on value 1 or any value <>0. I'm guessing it all leads somehow to some sort of "vlookup" hybrid.
Any ideas how to combine vlookup in it?
Thanks
If there can only be one '1' per row, I was thinking of this
=SUMIF(INDEX(B:E,MATCH(G2,A:A,0),0),">0",$B$1:$E$1)
Otherwise if there can be more than one '1'
=INDEX($B$1:$E$1,MATCH(TRUE,INDEX(B:E,MATCH(G2,A:A,0),0)>0,0))
to match the first value greater than zero, in this case entered as an array formula.
A simple =SUMIF() formula will do, no other convoluted INDEX() and MATCH() nested formulas required.
Let's presume we have a data-table that starts at B2 and end at
F6, like this:
So now, to comprehend the solution, here's the syntax of SUMIF() formula (Function):
=SUMIF( range, criteria, [sum_range] )
So, what we want to do is:
go over the range of C3:F3 (and each other respective row)
the criteria to when to sum, is when this range contains 1
and we want to sum_range (sum up) fixed array of numbers, so $C$2:$F$2
So the result is (for row 3):
=SUMIF(C3:F3,1,$C$2:$F$2)
and we drag the formula down, producing expected result:
PS: I think this illustrates the point very well, as to why it's important to declare not only what your formula is doing but also, what you're trying to as in whole as there often is a better (easier) way to implement something, that you might not have thought of.
In other words, follow the Minimal, Complete and Verifiable Example
Hi all,
I have this excel where by I need to find the location of the item if they are found in column B.
So In my F column, I tried to write ifelse formula which didnt work.which is
=IF(D2="NULL","NONE",C((D2))).
My idea is if D2 is not null, use the value in D column to find the location in C column. In this example, fish no 4, so it is found, my F column should show the value "C" using the value shown in D column and use it as Row no in C column
I hope you guys get the idea and help me out a newbie in excel. Thanks in advance
=vlookup($D2,$A$2:$C$6,3,0)
you can use that in column F. Place that formula in F2 and copy down.
you could technically use it in column E as well, but you would need to change the 3 to a 2.
you did not say what you wanted to do if the D value was "Null" so I am going to take a stab at the dark and wrap you lookup formula in an if statement that will deal with "Null" or empty cells
=IF(OR($D2="NULL",$D2=""),"",VLOOKUP($D2,$A$2:$C$6,3,0))
That is the alternative formula to place in F2 and copy down.
Use the formula:
=IF(D2<>"NULL",VLOOKUP(D2,A2:C6,3,FALSE),"Value is NULL")
Here is the working example:
Put formula in cell F2 and drag it down.
[edit]to pull proper location column, not just the row #[/edit]
Seems like a job for MATCH+OFFSET
Try this formula in cell F2:
=OFFSET($C$1, MATCH(E2,B:B,0)-1, 0, 1, 1)
Match is used to locate the value in the first argument (ie E2) within the range specified in 2nd argument (ie B:B). I use B:B but you could also use range B2:B30 or whatever more specific range you want. (I prefer the more generic B:B, though :) )
Third paramter "0" just indicates "Exact match".
This function will retun "#N/A" if nothing found.
OFFSET takes the result from MATCH to pick out the Location you want. The first parameter in OFFSET is the rows below (or above if negative) from the base row (in this case $C$1). the next is the column: 0 since we're in the column we want to be in. The last two are the size of the range: 1,1 is a 1x1 cell, so just 1 cell. If we did ...,2,3), that would be 2 rows high and 3 columns wide - or a 6 cell range. We're just after 1 cell here.
I've always preferred MATCH + OFFSET to other options, I just found they held up more robustly to changes in a sheet (ie new rows/columns added). So it's mostly personaly preference over VLOOKUP and INDEX. I honestly have never compared their actual performance, however, I've never had any issues with MATCH+OFFSET running slowly :)
I have 2 columns in my spreadsheet, both contains some numbers, column A has list of all numbers, and column B has some of the numbers from column A, now i want to highlight those numbers in column A, which are in column B here's my scenario:
Column A Column B
20301316 20322063
20302140 20322451
20307329 20326125
20307557 20334858
20314386 20371898
20314840 30368489
20322451 30384472
20326125 30384510
20334858 30384531
20371898 30384661
Here
20322451
20326125
20334858
20371898
should get highlighted. i used vlookup for this but for some reason it's highlighting all the numbers, here's the formula i used inside Conditional Formatting: (considering column A has values between A1:A10 and B has B1:B10)
=NOT(ISNA(VLOOKUP(B1, A1:B10, 1, 0)))
Could anyone please help me with proper formula.
Vlookup returns a value. In this context it is not the best formula to use, especially if you use it to return the value that you are looking up.
MATCH() is a much better fit for this scenario.
=MATCH(A1,$B$1:$B$10,0)
No fuffing around with ISNA() or wrapping in NOT() required. If it's a match it returns a number and will get formatted. If it's not a match, it won't get formatted.
It looks like you got the formula a bit backwards as it's looking in column A for values from column B. Try this instead:
=NOT(ISNA(VLOOKUP(A1,$B$1:$B$10,1,FALSE)))
Also, note that I made the lookup range an absolute reference by adding dollar signs.
Really though, I'd prefer a COUNTIF formula for this, just because I think it's more obvious:
=COUNTIF($B$1:$B$10,A1)>0
I have a new question concerning formulas in Excel. Thing is, I have a sheet, sheet2, containing dates and values. Currently I am using a combination of the index() and match() functions in to fetch different values, according to certain conditions - one being the date, from sheet2 into another sheet, sheet1, .
The data in sheet2, will be updated from time to time wherefore certain dates in the data will obviously "disappear" and of course, yield an error in the index-match formulae, not being able to find the value at hand.
My question is then, if there is an easy way to write the formula so that if the date we try to find from sheet1 is less than the current date, transform current value into constant value. The pseudo code would be something like,
IF date_to_find from sheet1 IN sheet2 > todays_date Then
Set value to constant (do not evaluate formula)
Else
Find value in sheet2 where the dates are matched in both sheet1 and sheet2
End
I know the easiest way might be to just implement the whole thing in VBA, but just wanted to check if anyone had a nicer solution.
Current formula in sheet1 is
'A872 = "2013-05-17"
'F872 is the goal cell (containing formula)
'$A$1:$K$100 contains date in format "yyyy-mm-dd" (given as column)
'$A$2:$K$2 contains currencies (given as row)
'$A$3:$K$3 contains text (also given as row)
IFERROR(INDEX('sheet2'!$A$1:$K$100;MATCH(A872;'sheet2'!$A$1:$A$100;0);_
MATCH(1;('sheet2'!$A$2:$K$2="EUR")*('sheet2'!$A$3:$K$3="Matching text");0));"")
So, if current date is "2013-05-17", the formula evaluates perfectly and returns, say, 400.000. But tomorrow, "2013-05-18", there is no need to change the cell (2013-05-17 value has past), so I would now like to FIX this value, so that the formula doesn't try and find "2013-05-17" in sheet2 no more. I.e. I want cell F872 to just say "400.000", and not "IFERROR(INDEX(...)"
Thanks,
Niklas
You could just wrap your formula in an IF-statement like this:
=IF(A872<TODAY(),[your formula],[constant value])