Excel: adding value if the other cell contains certain value - excel

here is the problem which is pretty self explaining.
I need excel to run through each row in A column and if it's 'volvo' (in this case) i need it to add the value next to it. The sum of values should be in the cell below (A5).
The poor solution which I came up with and does not work is =SUM(IF(ISNUMBER(SEARCH("volvo";A1:A3));B1:B3;0))
Thank you for every reply!

Use SUMIFS()
=SUMIFS(B:B,A:A,"volvo")

Related

How to make row number dynamic in Excel VLOOKUP

I am trying to figure out how to make the row number portion of my VLOOKUP formula to be generated based on the current row of the cell holding the formula.
=VLOOKUP(D209|M196:O372|2|FALSE)
So in the above, the first parameter is 'D209'. I want the '209' to be generated dynamically based on the current row.
I can get it with
=ROW()
But when I try to combine the two it breaks :(
=VLOOKUP(D=ROW|M196:O372|2|FALSE)
Thanks!
I found the answer:
=VLOOKUP(INDIRECT("D"&ROW())|M196:O372|2|FALSE)
Gotta use INDIRECT()

Using “<>” logic in an Excel Sumifs formula.

I apologize in advance if my question is unclear. It’s my first time posting on this forum. I’m trying to write a Sumifs formula in Excel where one of the criteria is to sum everything except a specific value. I write a small amount in SQL and i use the <> function to eliminate specific values. Is there a similar ability in Excel? Thank you for your help!
With SUMIF() or SUMIFS(), you can use <>:
=SUMIFS($A$1:$A$100,$B$1:$B$100,"<>123")
That will check if a value in your B1:B100 range is 123, and if so, will not use that equivalent value in the A1:A100 range.
Microsoft Excel has a NOT function.
So, you would say
=NOT(A2="yourtest")
In this case, it means it returns true if A2 is not the string "your test"
I think that maybe your syntax for the criteria is not correct.
This formula works to exclude the string "A" from the summed results...
=SUMIF($A$1:$A$6,"<>A",$B$1:$B$6)
If you are trying to exclude "A" by referencing a cell that "A" is stored, this will not work. For example
=SUMIF($A$1:$A$6,"<>E1",$B$1:$B$6)
Here is a working example in excel:

How do I increment just one number in a formula?

How do I increment just one number in a formula?
Here is my formula
=LOOKUP(C1-1,B3:B365,D3:D365).
I want to drag the formula along the row so that just the one number increases by one increment for each cell accross.
So the next cell would read
=LOOKUP(C1-2,B3:B365,D3:D365).
Here is a little abuse that will do what you need:
=LOOKUP($C$1-ROW(1:1),$B$3:$B$365,$D$3:$D$365)
assuming you are dragging down.
If you would drag to the right, you would have to substitute ROW(1:1) by COLUMN(A:A)
You can fix rows like this:
...,B$3:B$365,D$3:D$365
Thanks for all you help guys, but the formula requirements changed, but I managed to find out how to do what I needed to do in the end.
I used another cell reference form the row above the formula to increment the part of the formula that required it.
I needed to develop it further though so that the #N/A's were ignored.
The formula eneded up as --->
=IFERROR(LOOKUP($C$1-B371,$B$3:$B$365,$D$3:$D$365),"")
Thanks for all your suggestions though. I find these support communities veru useful and will use them a lot more often in the future.

VLOOKUP a value to the left of the Lookup_value

Using Excel, is there any way to use the VLOOKUP function to find the date corresponding the minimum and maximum values?
With your layout #Mark is correct (you can't) and for the reason stated. INDEX/MATCH may be a suitable alternative but to provide some detail, please try in say I30 copied across and down to suit:
=INDEX($H$6:$H$26,MATCH(I27,I$6:I$26,0))
No, there is no way to look left using VLOOKUP - it can only look right. You should look at INDEX/MATCH combo to solve this.
If you're willing to use a helper column to hold the date, you can. In my example I added the helper column in column N. So column N also displays the date from column H.
=VLOOKUP(I27;$I$6:$O$26;7;0)
=VLOOKUP(I28;$I$6:$O$26;7;0)
...
There is an easy solution for this - if you don't insist on using VLOOKUP() :-)
Above your row 27 enter a new row, repeating the column headings ("Thomson" etc.). You can just use =I5, =J5 and so on.
Now enter this formula in I30: =DGET($H$5:$N$26;1;J27:J28) ... and drag it to the right.
For the maximum values you need to repeat the column headings just above the "maximum" row again.

Getting the last non-empty cell in a row

I am having a lot of difficulty trying to come up with a way to 'parse' and 'order' my excel spreadsheet. What I essentially need to do is get the last non empty cell from every row and cut / paste it a new column.
I was wondering if there is an easy way to do this?
I appreciate any advice. Many thanks in advance!
Are your values numeric or text (or possibly both)?
For numbers get last value with this formula in Z2
=LOOKUP(9.99E+307,A2:Y2)
or for text....
=LOOKUP("zzz",A2:Y2)
or for either...
=LOOKUP(2,1/(A2:Y2<>""),A2:Y2)
all the formulas work whether you have blanks in the data or not......
Okay, from what you've given if I understood correctly, you can use this formula in cell J1 and drag it down for the other rows below this cell:
=INDEX(A1:I1,1,COUNTA(A1:I1))
This assumes that the 'longest row' goes up to the column I.
You can also use OFFSET. You don't need to specify an ending column, you can just reference the entire row.
=OFFSET(1:1,0,COUNTA(1:1)-1,1,1)

Resources