IFERROR VLOOKUP Sheets - excel

Frustration finally boiled over and had to post here.
I have a Google Sheet where I want a sheet (LOG) to have a formula that will search for a name on a different sheet (DAY 1), and if the name has a value in the cell adjacent to it, that the formula on DAILY return that adjacent cell value.
Right now, I am using an IFERROR to lead the equation. This will return a value of "0" for when a name does not occur (since different names will occur on different days).
Then I attempt a VLOOKUP, and I think I'm putting the criteria in correctly, but it doesn't give me the answer I want. That is in the document, I want cell B4 on page LOG to reflect that the name Smith, John is found on the page DAY 1, and that there is a value on cell C4.
Can anyone assist with this?
https://docs.google.com/spreadsheets/d/10tS6gqtEpp55OJpYa1jSMKmbm8qU5ZzRu0rqFWHegi0/edit?usp=sharing

You have errors in formula
=IFERROR(VLOOKUP(A4,'Day 1'!A4:A13, 3,FALSE, 0))
You specify parameter 3 - colindex=3 while parameter 2 - range consists of one column
Incorrect placement of brackets
Correct formula:
=IFERROR(VLOOKUP(A4,'Day 1'!A4:C13, 3,FALSE), 0)

In this case VLOOKUP isn't your best option, try using SUMIFS instead:
=SUMIFS('Day 1'!$C$4:$C$13,'Day 1'!$A$4:$A$13,A4)
This function fills your need.
I would also recommend having one tab for all your "raw" data for each day like this:
And using this formula instead, you can drag right and down now:
=SUMIFS('Day 1'!$D$4:$D,'Day 1'!$A$4:$A,B$2,'Day 1'!$B$4:$B,$A4)
Hope you find this more useful :)
-this is my first post
https://docs.google.com/spreadsheets/d/1LXgZfKvUt7lrp4E8tAqaYEmSmZwjEbDYcQD8j1jHReY/edit?usp=sharing

Related

Excel - How to count the number of distinct texts of a specific date inside a table?

I'm trying to count the number of distinct text from a specific date in a data table.
Data Sample with expect result :
I was able to figure out how to count the distinct element from a range I specify, because I can determine the first and last row containing the date.
=SUMPRODUCT(1/COUNTIF(B2:B15,B2:B15))
I have tried to modify my formula so that it determines the cell range by itself but without success.
I searched for an answer, using a combination of CELL and MAXIFS, example below, but Excel does not accept the formula.
=CELL("row",MAXIFS(A2:A15,A2:a15,D2))
I've looked at the INDEX formula, but I can't figure out how to do what I want to do. 😑
Any idea what I'm doing wrong, or what I should be doing instead?
Thanks, I appreciate it!
If you have Office 365 and the new Dynamic Arrays, this sort of formula has become ridiculously easy.
This formula in cell E3:
=COUNTA(UNIQUE(FILTER($B$2:$B$15,$A$2:$A$15=D3)))
Copy down.
You can also generate the unique list of dates with this formula in D3, which spills down automatically and does not need to be copied.
=UNIQUE(A2:A15)
It wasn't easy, but by separating each step of the problem, I was able to solve it.
Note that my solution only works because my dates are sorted.
Here's the final formula in the cell "One formula to rule them all":
=SUMPRODUCT(1/COUNTIF(INDIRECT(CONCATENATE(ADDRESS((MATCH(D3,$A$2:$A$15,0)+1),2),":",ADDRESS(MAX(($A$2:$A$15=D3)*ROW($A$2:$A$15)),2))),INDIRECT(CONCATENATE(ADDRESS((MATCH(D3,$A$2:$A$15,0)+1),2),":",ADDRESS(MAX(($A$2:$A$15=D3)*ROW($A$2:$A$15)),2)))))
Here are my explanations of my process:
Formula if I select the range :
=SUMPRODUCT(1/COUNTIF(B2:B15,B2:B15))
Formula to get the first iteration
=ADDRESS((MATCH(D3,$A$2:$A$15,0)+1),2)
Formula to get the last iteration
{=ADDRESS(MAX(($A$2:$A$15=D3)*ROW($A$2:$A$15)),2)}
Create range from two addresses
=INDIRECT(CONCATENATE(F3,":",G3))
Formula giving me the expect result
=SUMPRODUCT(1/COUNTIF(INDIRECT(CONCATENATE(F3,":",G3)),INDIRECT(CONCATENATE(F3,":",G3))))

How to define a range, using an Excel formula

In order to do some calculations on averages and differences of values in columns, I've defined a name, based on a range, but it seems to be completely going berserk:
I have a cell (D13), defined as Header_First _Answer, which contains the title of the column, and I have a value (currently being 69), which contains the number of entries, called Total_Count.
I've defined the entries of that column as another name: "All_First_Answered_Dates", defined as =OFFSET(Header_First_Answer;1;0):OFFSET(Header_First_Answer;Total_Count;0) (start by the first entry under Header_First_Answer, take up to 69 entries, and define a range out of this).
In cell G5, I'm using that name in order to do some calculations (calculating averages), but this seems not to work (there is a #Value error).
After second comment from Rory: G5 formula and first formula evaluation result:
Formula:
=AVERAGE(IF(ISBLANK(All_First_Answered_Dates);TODAY();All_First_Answered_Dates) - All_Start_Dates)
First evaluation result:
=AVERAGE(IF(ISBLANK(#Value!);TODAY();All_First_Answered_Dates) - All_Start_Dates)
Hence, my conclusion:
After some checking I've found out that this is due to the name "All_First_Answered_Dates", which seems to be interpreted one time too many (or how do I explain this):
In different cells, I've entered the formula =OFFSET(Header_First_Answer;1;0):OFFSET(Header_First_Answer;Total_Count;0) (which is exactly the meaning of "All_First_Answered_Dates"), and every time, using the Evaluate Formula feature, I see that the last but one result is correct: $D$14:$D$82. However, after that, another evaluation is done, turning this value into 43283 (in case the formula is entered in "J14"), 43300 (in case the formula is entered in "J15"), ..., and in case I enter this formula in a cell with row number lower than 14, I have the error value #Value (which explains the wrong result in cell G5).
If I simply put the formula =$D$14:$D$82 in any of the mentioned cells, then the content of some cells in column D are shown (which are dates, not values like 43283 or 43300).
It appears that declaring a range as =x:y, where x and y are formula results, is not working.
Does anybody know how I can define a range as a formula, which I can then use in order to define in a name?
I can imagine my explanation being quite complicated without an image, hence the attached screenshot. In there:
In cell J13, there is the formula =OFFSET(Header_First_Answer;1;0):OFFSET(Header_First_Answer;Total_Count;0).
In cell J14, there is the same formula.
In cell K14, there is the formula =$D$14:$D$82.
For completion purposes, hereby a screenshot of the name manager, containing both mentioned names (the ones, selected in the name manager):
Edit after first comment:
The idea behind the range is the following:
1. Take the first row under Header_First_Answer, do not take any other column : OFFSET(Header_First_Answer;1;0)
2. Take the Total_Count's row under Header_First_Answer, do not take any other column : OFFSET(Header_First_Answer;Total_Count;0)
3. Define a range, based on those two cells, by putting a semicolon between them.
I was not aware of the height and width features of the Offset() worksheet function. I've implemented them, which makes the formulas much easier.
Unfortunately the problem still persists.
Thanks in advance
Dominique
I've just found the answer of what was going wrong:
The formula was meant to be an array formula. Something went wrong and while trying to debug, I accidently re-formatted the formula into a normal formula (I must have pressed "ENTER" instead of "Ctrl" + "Shift" + "ENTER") at some point.
I have re-applied array formula (using "Ctrl" + "Shift" + "ENTER"), getting a formula like:
{=AVERAGE(IF(ISBLANK(All_First_Answered_Dates);TODAY();All_First_Answered_Dates) - All_Start_Dates)}
(mind the braces {, })
Now everything is working fine.

Best function to get a cell from the same row as another cell on a separate sheet

What is the best function to get a cell from the same row as another cell on a separate sheet. On sheet 1, A2 is a lead id and B2 is a name. On sheet 2, if I put in the lead id on A2, I want the name to autopopulate in B2. The function I used is =IF(A2=Leads!A:A,Leads!B:B," ") Now, it works fine with my first two leads but then it returns the false value on all the others. It has worked a couple times but it seems really glitchy. Any better way to accomplish this?
I think you should be able to use a vlookup function for this. Try putting the following formula into Sheet2 cell B2:
=VLOOKUP(A2,Sheet1!A:B,2,FALSE)
vlookup will work (Chris Moore answered with this)
Personally I prefer using index/match because if you alter the structure of the sheet by inserting or removing columns the formula adapts better and also because index match can lookup columns in any order and uses more precise ranges
=INDEX(Sheet1!B:B,MATCH(Sheet2!A2,Sheet1!A:A,0))
For a more in-depth explanation there is one here: https://www.deskbright.com/excel/using-index-match/

EXCEL - Find category by searching keyword from other worksheet

I want to get sales by category (states).
In Sheet1, there're state's names in row A (A1 to A6) and cities in the column.
Each cities belongs to states,
e.g.
Sydney belongs to NSW, and Melbourne & Geelong belong to VIC.
Then Sheet2 contains sales data like shown below.
I want to calculate sales by state each month.
At the moment, each cells between row D and row I has a formula like below;
(e.g. F5)
=IF(AND(ISERR(SEARCH("Brisbane",B5)),ISERR(SEARCH("Gold Coast",B5)),ISERR(SEARCH("Cairns",B5))),"",C5)
But I'm sure there would be better and more simple nifty way to do this. As shops increase, this current formula gets more complicated. So it's needed to be optimized.
I would like to make these calculation simple using vlookup or something.. but no luck so far.
Any advice, detailed if possible, would be greatly appreciated! Thank you in advance :)
You can do this with an array formula. For example, in D3 use:
=IFERROR(IF(INDIRECT("Sheet1!A"&MAX(IF(ISERROR(SEARCH("*"&Sheet1!$B$1:$D$6&"*",$B3))+(Sheet1!$B$1:$D$6=""),0,ROW(Sheet1!$B$1:$D$6))))=D$1,$C3,""),"Not found")
(To enter an array formula, you need to press Ctrl+Shift+Enter)
The SEARCH looks at the store name in B3 and compares it to all names in Sheet1!B1:D6 with a * wildcard before and after. This won't be an error if it matches.
Adding the +(Sheet1!$B$1:$D$6="") gives an OR the cell is blank (otherwise ** would match).
If it isn't an error, we'll get the ROW of the corresponding match and we take the highest (MAX) row match.
We then use INDIRECT to get the cell value in column A of Sheet1 (the State code) and compare that to the state in the top row of our column
This is wrapped in an IFERROR to tell us if our store doesn't match any city
Array formulas are a great tool, but a little confusing! Rather than work on a single cell, array formulas work on each cell of an array. Typically this is for counts, sums, averages, etc. By including “logic maths”, you can do some really strange things in a single formula. A good resource is [link]http://www.cpearson.com/excel/arrayformulas.aspx Always remember to use Ctrl+Shift+Enter or really strange things will happen!

How to look up information based off a single cell? In Excel

I've been working on VBA for so long I forgot how to do this...using formulas.
I have a cell that has a descriptor in it, in this case K1122121. The cell next to it, will be the description. On another sheet I have a list of parts, I need to look up said part number on sheet 2, and place the description next to the part it's looking up.
I know it's possible, I just forget how.
So to recap.
Sheet one has two cells, the first is a part number, the 2nd next to it, is where the formula is going, in this cell will produce the description to said part number.
Sheet two has part and description side by side. I need to reference the part number and find the description.
Once the description is found, place said description in the description field in sheet one.
Thanks for the help.
Here is a link of what I am working on. https://dl.dropbox.com/u/3327208/Excel/PAERTO.xlsm
It's called VLOOKUP and you call it like this:
=VLOOKUP(A1,Sheet2!A:B,2,FALSE)
Where:
A1 is the cell with the part number in sheet1
Sheet2 the sheet where the data is located (descriptor / description)
A:B is the range in sheet2 where the data is located
2 because what you are looking for is in the second column
FALSE to only get a value for exact matches - if no exact match is found, it will show an error
EDIT
Looking at your workbook, I would personally insert a new column in the jobs list (say between D and E) with a formula that only keeps the first word only - formula in E3:
=IF(ISERROR(FIND(" ",D3)),D3,LEFT(D3,FIND(" ",D3)-1))
Then the formula in the PAERTO sheet then becomes - formula in D20:
=VLOOKUP($E20,'Jobs List'!$E:$F,2,FALSE)
in the example you provided, I get a result for lines 20, 22 and 24, and an error on the other lines.
I can get a result if I use this formula:
=VLOOKUP(E20&" Rev"&F20,'Jobs List'!D:E,2,0)
However you need to change cell F20 to 4.
As long as part number and "Rev" are consistent between sheets, this formula should work.
Note that only cells D20 and D24 return values. The other part numbers don't exist on the other sheet, so regardless of what formula is used you will not see a return value.
With your part number in A1, in B1 the formula =VLOOKUP(A1,Sheet2!A:B,2,FALSE) will find the description
If you are on Excel 2003 or earlier, you will have to change Sheet2!A:B to be a full reference like Sheet2!A2:B2000
The answer was a little more complex than I was hoping, but I ended up using this as an answer. It may not be the most simplistic, or elegant, but it works.
=IF(E20=0,VLOOKUP("*"&E20&"*",'Jobs List'!D:E,2,FALSE),VLOOKUP("*"&E20&"*",'JL Archive'!D:E,2,FALSE))
I used the "*" to make it so that it utilized wild cards, something I never thought of using... but it works. I put the wildcard usage in front and behind so just in case any cells may have something more than the required text in the front of the part or behind it.
I hope this helps people. The original use for this was so I can use the formula can be used from another workbook, but as we all know this can be used anywhere. Enjoy :)

Resources