Excel VLOOKUP/ INDEX multiple times based on value - excel

So I want to be able to change the values from Pic2 in rows "ZERO" and "LINE-IN" and have it reference the table to output the value from the even number of rows. In Pic2 if I enter "AA","CC","BB" into row "ZERO" and "3","2","1" into row "LINE-IN" then it would take "AA" from "ZERO" on Pic2 go to column A on Pic1 and find the match, then Look within row 1 Pic1 to find "3", then output "Z" from row 2 into the "LINE-OUT" row. So, the value "CC" in row "ZERO" with value of "2" in row "LINE-IN" will output the value of "X".
I have came across a few possible ways to accomplish this using VLOOKUP, INDEX, MATCH, and IF. All solutions and the ways I can think to do what I asking requires to build multiple tables and that doesn't seem very practical the way I am imagining.
I am really looking for one or two formulas that I can reference instead of making several different tables to accomplish the same thing.
Thanks for any help or guidance towards a solution and sorry about having to follow the links for the pics.

I'm confused about how you've set your table up. If you set it up as follows:
then it is a very simple Index/Match function.
For instance, if the tables were arranged as above, then the formula in cell B8 that will change as you change cells B6 and B7 is:
=INDEX($A$1:$D$4,MATCH(B7,$A$1:$A$4,0),MATCH(B6,$A$1:$D$1,0))
and you only need one table

Related

If-then statement with multiple options

I have been working on an IF statement where there are multiple answers but I can't seem to get the formula to work. The If statement is going to look at two columns of data and should pull back the first NUMBER. Sometimes the first column will say "#N/A N/A" in which case the formula should look to the second column and pull that NUMBER. If both columns say "#N/A N/A" then I would like the answer to be "NR".
In another scenario I will have three columns of data. I would like the formula to pick up the first number in the columns no matter what follows. Again, if all three columns say "#N/A N/A" I would like the answer to be "NR".
I will attach two examples of what I am talking about. Here is the formula I have now but I can't seem to get it to work:
=IF(ISBLANK(B3),"",IF(D3="#N/A N/A",$D3,$D4))
Unfortunately, this formula isn't taking into account if D3 is actually a number. It also doesn't account for if both D3 and D4 are "#N/A N/A".
Any help would be greatly appreciated.
Thanks,
Here is the example :
This allows the use of many columns without the need for multiple nested ifs.
It will return the first column that is not #N/A N/A:
=IFERROR(INDEX(3:3,,AGGREGATE(15,6,COLUMN(D3:E3)/(D3:E3<>"#N/A N/A"),1)),"NR")
So to do more columns simple change both the D3:E3 to the range desired. The 3:3 should match the row being searched.
You can check each cell (from left to right) and return the first instance of a numerical value using a combination of IF & ISNUMBER
Checking 2 Columns
=IF(ISNUMBER(D3),D3,IF(ISNUMBER(E3),E3,"NR"))
Checking 3 Columns
=IF(ISNUMBER(D3),D3,IF(ISNUMBER(E3),E3,IF(ISNUMBER(F3),F3,"NR")))

Excel: Get values in non-adjacent cells based on multiple criteria

I have an excel sheet sort of like this:
I'm trying to figure out how to get the totals in cells B1 through B4.
I tried INDEX-MATCH, where I tried to match the words in A1:A4 with the words in row 7, get the numbers relative to them, and then sum them, but it was a lot of Google searching and stabbing in the dark -- every attempt returned an error.
I also tried to INDEX-MATCH the words in A1:A4 with row 7, and then nest a VLOOKUP in there where it'd get the number relative to "visits:" but that didn't work at all either.
Is INDEX-MATCH even the correct function? Any help would be much appreciated, I'm not even sure what to Google anymore.
EDIT: I need to use a search function of some kind, like the INDEX-MATCH method, rather that static formulas because the sheet will change periodically and I don't want to have to update the formula every time I add an animal.
Your data table is unusual in structure.
However, if you are gong to keep a fixed rule such that the number of visits is always offset 2 rows and 1 column from the animal type(and that itself is always in row 7), you could do:
In B1:
=SUM(IF($A$7:$AAA$7=$A1, $B$9:$AAB$9, 0))
Confirm with Ctrl-Shift-Enter, and then copy down..
DOes this work?
=SUM(IF($B$7=A1,$C$9,0),IF($D$7=A1,$E$9,0),IF($F$7=A1,$G$9,0),IF($H$7=A1,$I$9,0))
I'm not sureto have fully grasped your challenge. Yet it seems the following solution would work:
Add the following formula in each box where the number of visits is added as
=+SUMIF($A$1:$A$end;animal;$B$1:$B$end)
Where end is a number of the last cell in the first and second columns data contain the data.
And animal is the cell that contains the name of the animal.
Therefore in your simple example, the formulas on cells C9;E9;G9 and I9 would be respectively:
=+SUMIF($A$1:$A$4;B7;$B$1:$B$4) ; =+SUMIF($A$1:$A$4;D7;$B$1:$B$4); =+SUMIF($A$1:$A$4;F7;$B$1:$B$4) and =+SUMIF($A$1:$A$4;H7;$B$1:$B$4).

How do I search across sheets in Excel

I want to transfer data automatically from 2 sheets to one single combining one. That means I have 2 different exports that contain both the columns "Problem". I have one sheet, that represents an overview of the data. So when I have for example the value "A333" in A1 of my overview sheet, I want Excel to search in the two other export sheets the value "A333" and give back the value in the same row as "A333" but of the column "Problem" not "A".
The problem that I see is that I have to search TWO sheets and I don't know in which one the "A333" will appear.
Can you please help me? I would preferably like to solve the problem with a formula, not a macro. Thank you very much in advance.
1) write a formula (VLOOKUUP() for example) that looks for the value in the first sheet
2) write a formula that looks for the value in the second sheet
3)since VLOOKUP returns an ERROR if a value is not found you can combine the formulas together using IFERROR(). for example: =IFERROR(VLOOKUP(ref_cell,sheet1_range,2,0),VLOOKUP(ref_cell,sheet2_range,2,0))
EDIT:
It looks like you did not provide all the pertinent information in your question!
I suggested VLOOKUP(), but this will only work if you know which COLUMN the value you are looking for will appear in, but you said this is not the case...
using you comments I therefore assume the following:
the two test sheets are called "test1" and "test2"
The reference value we are looking for is in cell A5 on the main sheet, cell D1 on the sheet contains "Problem" (text)
The reference value may appear anywhere (I limit here to range A1:J100) on test1 or test2, but ONLY ONCE
The column "Product" on test1 and test2 may appear in different columns, but it will always have a heading "Product" in row 3 (test1!A3:J3 and test2!A3:J3)
see below of screenshot of the answer (column C shows result, column D shows the underlying formula)
If required use the information provided to create a single-cell formula (because Stack Overflow is not a we-write-the-answer-for-you service)
Following the scheme:
and add the formula:
E3 -> =CONCATENATE(IFERROR(VLOOKUP(D3;$A$12:$B$15;2;FALSE);"");IFERROR(VLOOKUP(D3;$A$3:$B$6;2;FALSE);""))
and autocomplete ...

Can a countifs do this or do I need an array?

I have a data range B5:L100.
In column B is a string identifier, say 'X' or 'Y'.
In columns C:L we have different people's names entered (never more than once per row).
I want to count how many times a person's name appears in rows where column B is 'X'. The following formula doesn't work (using "Max" as the example person to search for).
Can you advise on what will do this elegantly?
=COUNTIFS(C5:L100,"Max",B5:B100,"X")
I think an array formula might be in order, but I'm not too experienced on those.
One way to do this is to just do it column by column:
=COUNTIFS(C5:C100,"Max",B5:B100,"X")+COUNTIFS(D5:D100,"Max",B5:B100,"X")... etc
Does the trick, but not too elegant if you have loads of columns to look through. I'm sure there's a tidier way using an array formula.
=SUMPRODUCT((C5:L100="Max")*(B5:B100="X"))

Count paired instances where their elements are in different columns

My searches for answers have been limited by my lack of knowledge of the appropriate terminology. My goal is to count the number of times a specific username appears in one column AND the number 1 appears in another column for that user. I attempted to use COUNTIF, but it doesn't seem to format for that purpose.
What I'm needing is to count the number of instances "username" appears in column K when "1" appears in column Q.
If you have =COUNTIFS (you don't mention which version of Excel) please try, in Row1 and copied down to suit:
=COUNTIFS(Q:Q,1,K:K,K1)
there may be better ways (eg a PivotTable, an array formula or =SUMPRODUCT) but this could be one of the simplest.
Alternatively of course just filter and read the count in the bottom left-hand corner of your screen.
Showing COUNTIFS, SUMPRODUCT, PivotTable and filter options:
In this special case, because one of your criteria is 1, you might also use SUMIFS.
Because the data happens to start with a list of unique Users in order the COUNTIFS version in Row2 (adjusted to K2 from K1) entered with Ctrl+Shift+Enter and copied down to Row 6 will show a result similar to that in the PT.

Resources