I don't have any experience with creating excel data validation formulas.
I have 2 code formulas, which are generated in java code, which are coming from excel data validations:
COUNTA('User Input Sheet'!A:A)-4
IF(COUNTA(INDIRECT(ADDRESS(ROW(A5),COLUMN(A5),1,1,"User Input Sheet") & ":" & ADDRESS(ROW(AJ5),COLUMN(AJ5))))=0, "","POP")
Can someone help me how to write the data validation formula for the above two, as I have to use for different cells, but don't know how to put in cell data validation ?
Providing more information on what it is you're actually trying to do, will help you, as well as helping anyone who's trying to help you. e.g.:
Your 1st formula returns the number of non-empty cells in column A of a sheet, less 4.
But you don't say if the cell being validated needs to be more, less, the same or not the same as that. If you know the answer to that, the formula as is (with = in front) will work directly in the Data Validation 'value range' fields. e.g.:
The above example validates that a cell value is between zero and the results of the formula.
Suggest adapting and applying that, and if you're not getting the expect result, explain what you were aiming for, what you did, and what the results are.
=====================================================
The second formula is more problematic in terms of trying to guess what it is you're trying to do.
One thing I'll point out first thought: it uses INDIRECT in a completely unnecessary way (and that's inherently unwise). So the first thing to do is covert to a direct reference per:
=IF(COUNTA('User Input Sheet'!A5:J5)=0, "","POP")
But even then, you have a formula that returns a zero-length string ("") or literal 'POP' (based on A5:J5 being empty or not).
And it's unclear how you intend to use that to validate a cell. One guess would be the user has to enter "POP" or nothing (depending on A5:J5 being populated or not). But that seems to be an odd thing to do.
Related
Summary
I need an array formula that takes a row of data of certain length from Sheet1. For that row, in each column that is not blank, I need to grab the Sheet1 header value for that column and display that data in a continuous row on Sheet2 (without any spaces in between the row's cells).
Background
I have a table of data (employees and industry certifications with expiration date being the table's cell data) on sheet 1, with a row for each employee the spreadsheet is tracking. The certifications are the columns.
We are using this information to link to ID Badge Printer software (Bodno Silver), where we are limited to linking columns of data to a particular textbox.
The problem lies in the fact that not everyone has every certification. The rows are peppered with blanks separating the certifications that each employee does have. While setting up the required text boxes in the badge software template, that each link to a specific column, I quickly realized that since not everyone has every certification if we used the data how it was we would have a bunch of strange looking blanks in between the listed certifications rather than a continuous list.
What I did
My solution to this (which I'm open to a better one if anyone knows of one, other than "use better software"), was to create a new sheet and array formulas that no one would use except for me and the id printer software. This sheet would have a similar data table that took the rows of data interspersed with blank cells between expiration dates, and put the matching column headers for cells that had a date in them into a continuous row of the same maximum length (eliminating the blank cells).
Essentially, this would allow me to circumvent the restrictions of the badge software and each textbox would be MatchedCert1, MatchedCert2, MatchedCert3, etc. up to the original maximum number of certifications.
Pictures are probably better than my words at explaining what I am going for:
Sheet1 (source)
Sheet2 (result)
The array formulas
I worked on this one for a while. What I thought would be a simple INDEX, MATCH, ISBLANK formula (that I could create using the appropriate relative and absolute cell linking) and then expand to the whole sheet turned into a witch hunt and me praying for forgiveness for my sins to all that may be holy. Also a lot of googling.... I realized quickly that this one may not be so simple after all.
Finally, I arrived at the following two array formulas in order to correctly show what I was going for:
First Column of training section
{=IFERROR(INDEX(Sheet1!$E$2:$P3,1,MATCH(FALSE,ISBLANK(Sheet1!E3:Q3),0)),"")}
(easy enough, right? I thought so...)
I felt good about this until I tried to think through what would be required to get the formula to be universal so that I could use it on the entire table.
I feel dirty just putting the following in public, but here goes...
Second column through last column array formula
{=IFNA(INDEX(INDIRECT(ADDRESS(ROW($E$2),(MATCH(E3,Sheet1!$2:$2,0)+1),1,1, "Sheet1")&":"&ADDRESS(ROW(E3),COLUMN($Q3),1)),1,MATCH(FALSE, ISBLANK(INDEX(INDIRECT("Sheet1!"&ADDRESS(ROW(E3),(MATCH(E3,Sheet1!$2:$2,0)+1),1)&":"&ADDRESS(ROW(E3),COLUMN($Q3),1)),0,0)), 0)),"")}
(please don't call the police...)
[ninja edit] While this array formula works for 2nd result column through the final column, it doesn't work if there's not a blank column following the result range. The actual spreadsheet has 4 different groups of certifications that run horizontally, but I was able to just add a blank column in the corresponding data from the other sheet easily enough, so I just let it go. I'd give somebody a nickle for the answer to why that's the case here too [/edit]
Results
The first array formula, and INDEX MATCH using ISBLANK is rather straightforward.
The biggest question for me here, and the thing that drove me absolutely nuts for a couple of days, is why the second array formula requires the additional INDEX function nested inside of the ISBLANK function.
While taking the function apart and experimenting I realized that if I have any INDIRECT reference inside a ISBLANK function, which is itself inside of a MATCH function, the result of the match was ALWAYS 1:
{=MATCH(FALSE,ISBLANK(INDIRECT("$E3:$Q3")), 0)}
The above ALWAYS returns 1, whereas if I put the range in explicitly, the function would work just fine. That wasn't an option for me, since I needed to dynamically return the starting position for the match using the previous cell's address.
However, adding an INDEX function (with a column and row value of 0) to encapsulate the INDIRECT function provides the correct answer. I figured this out just by trial and error.
Questions
Can someone with more knowledge please let me know what is causing this behavior?
As a broader question, given I am limited to using formulas (no VBA), I would also like to know if I'm going about this in the wrong way or if there is a much simpler way of accomplishing this without this behemoth of a formula?
I know this sheet will probably require maintenance in a year - good luck future self!
Put this in E3, Copy over and down
=IFERROR(INDEX(Sheet1!$2:$2,AGGREGATE(15,6,COLUMN(INDEX($E:$P,MATCH($C3,Sheet1!$C:$C,0),0))/(INDEX(Sheet1!$E:$P,MATCH($C3,Sheet1!$C:$C,0),0)<>""),COLUMN(A:A))),"")
As to why your formula is not working, it is too convoluted to parse. One note, unless the sheets is the variable, one should avoid INDIRECT as much as possible. INDEX can almost always be used in its place.
Both INDIRECT and ADDRESS are volatile functions. Volatile functions will re-calculate every time Excel re-calculates, leading to a lot of unnecessary computations.
Not a solution but to answer why you are seeing this behavior:
EDIT: PREVIOUS EXPLANATION WAS JUST PLAIN WRONG
This confused me so, I did a bit of investigation:
I think that your problem is actually coming from the ISBLANK function because it is intended to be used with single values, and cannot handle ranges. Any BLANKs which are returned by functions are only converted to numeric values (0), when the BLANK is returned to (or displayed on) the sheet. If the function is returning to another function, the BLANK value seems to be preserved.
EDIT: ADDING A SOLUTION WITHOUT ARRAY FORMULAS
This is probably more complex than using an array formula... but I strongly dislike them, so do all I can to remove them.
Firstly, I would add an index to your positions in the results sheet:
=IF(F$7>COUNTIFS($F3:$L3,"<>"),
"",
IF(
MINIFS(
$F$7:$L$7,$F$7:$L$7,
">" & IFNA(INDEX($F$7:$L$7,MATCH(E9,$F$2:$L$2,0)),0),
$F3:$L3,
"<>"
)=0,
"",
INDEX(
$F$2:$L$2,
MATCH(
MINIFS(
$F$7:$L$7,$F$7:$L$7,
">" & IFNA(INDEX($F$7:$L$7,MATCH(E9,$F$2:$L$2,0)),0),
$F3:$L3,
"<>"
),
$F$7:$L$7,
0
)
)
)
)
Basically, the formula looks at the cert in the previous cell, and looks for the next, minimum index, greater than that.
I've been struggling with this longer than I care to admit, but I have a fairly simple OFFSET function call which works on one sheet, but if I copy it to a different sheet it gives a #VALUE error.
On a sheet named "Deliverable" I have this formula in a cell:
=OFFSET(Deliverable!$B$72,1,0,,3)
and it works fine.
If I go to any other sheet and use the same exact formula, or use it in the Name Manager, it gives a #VALUE error.
If I leave off the final parameter indicated the number of columns I want, it does work:
=OFFSET(Deliverable!$B$72,1,0)
but of course isn't giving me the range I need.
Any idea what's going on with this?
I'm using Excel 2016 on Windows 7.
-- Updated Info --
In a nutshell, my spreadsheet has two cells which I'm using as dropdown lists, where the 2nd cell's list feeds off the selection in the first. The data they are based on has this format:
OptionA A B C D
OptionB A B
OptionC D E F
So the first dropdown uses a simple Data Validation source pointing to the column with OptionA, OptionB, etc. Once that's chosen, the second dropdown list should contain the appropriate options for the one selected. So if OptionB is selected, then the 2nd dropdown list should show A and B.
When I initially wrote this, the data validation source was just a simple VLOOKUP entry, but the lists often had blanks since the number of options varies for each entry. Wanting to fix it up a bit, I ended up with this formula:
=OFFSET(Deliverable!B72,Deliverable!B87,0,1,COUNTA(OFFSET(Deliverable!B72,Deliverable!B87,0,1,5)))
There won't be any more than 5 options, and there are no empty cells in the middle of the data to filter out.
In one spreadsheet I have I used this as a named range definition, then specified the named range for the cells data validation source and it worked. In this other spreadsheet however, it gave me the error described earlier.
However, it looks like when I enter the statement directly into the data validation source field and not in the name manager, it works as expected.
Am I taking the totally wrong approach?
What is it that you want this formula to do? As written, it is returning a block of three horizontal cells. The #VALUE error is Excel's way of telling you "Hey, you're trying to return three cells, but I can't fit them all in the one cell that you are calling this formula from".
The reason you see a result in some places and not others is because of something called Implicit Intersection. Give it a spin on Google. But basically, it just returns whichever one of those three results corresponds to the column that the formula is entered into. If you copy that exact same formula to say row F you will see that it returns a #VALUE error there, because it doesn't know what cell it should return given the column you're calling it from doesn't match any of the cells it is returning. The fact that you don't know this indicates that the formula you're using doesn't in fact do what you think it does.
--UPDATE --
Okay, following your further clarificaiton it seems that you're talking about Cascading Dropdowns aka Dynamic Dropdowns. Lots of info on Google about how to set these up, but you may be interested in an approach I blogged about sometime back that not only provides this functionality, but also ensures that someone can't later on go and change the 'upstream' dropdown without first clearing the 'downstream' one should they want to make a change.
Note that those links talk about a slightly complicated method compared to others, but the method has it's advantages in that it also handles more levels than two, and your DV lists are easily maintained as they live in an Excel Table.
This sounds like an array equation. Try hitting Ctrl+Shift+Enter in the other sheets to validate it as an array equation.
Whenever you need to reference ranges instead of single cells, Excel needs to know that you are working with arrays.
First post, but I am stuck and was hoping for some help. What I am trying to do is use a nested IF formula to determine whether the value returned by a VLOOKUP matches specific text on another sheet in the same workbook. If it does, to then use the COUNTIFS function to determine the sum of instances that specific text contained in a specific cell appears on another sheet (also in the same workbook).
One part of these formulas seems to work, but when I combine it with others, it errors and I can't figure out why.
It's probably something simple, but I'd appreciate any help. Here's the part that seems to "work"
=IF(VLOOKUP($A3,'Sheet1'!$B:$D,3,FALSE)="All",
(COUNTIFS('Sheet2'!$U:$U,'Sheet3'!$A3,'Sheet2'!$C:$C,"MM/DD/YYYY")
+
(COUNTIFS('Sheet2'!$R:$R,'Sheet3'!$A3,'Sheet2'!$C:$C,"MM/DD/YYYY")))
If I put one more parenthesis, it works as is, but seems to omit some of the "All" Vlookup results... thus why I put works in quotations above. That might be an issue with my spreadsheet though, but felt I should include in case I'm just being idiotic. Regardless, when I input two additional IF statements, it errors.
The final formula I've crafted looks like this (double spaced for ease of reading only):
=IF(VLOOKUP($A3,'Sheet1'!$B:$D,3,FALSE)="All",
(COUNTIFS('Sheet2'!$U:$U,'Sheet3'!$A3,'Sheet2'!$C:$C,"MM/DD/YYYY")
+
(COUNTIFS('Sheet2'!$R:$R,'Sheet3'!$A3,'Sheet2'!$C:$C,"MM/DD/YYYY")))),
IF((VLOOKUP($A3,'Sheet1'!$B:$D,3,FALSE)="One",
(COUNTIFS('Sheet2'!$U:$U,'Sheet3'!$A3,'Sheet2'!$C:$C,"MM/DD/YYYY")),
IF((VLOOKUP($A3,'Sheet1'!$B:$D,3,FALSE)="Two",
(COUNTIFS('Sheet2'!$R:$R,'Sheet3'!$A3,'Sheet2'!$C:$C,"MM/DD/YYYY"),
IF((VLOOKUP($A3,'Sheet1'!$B:$D,3,FALSE)="Three",
(COUNTIFS('Sheet2'!$U:$U,'Sheet3'!$A3,'Sheet2'!$C:$C,"MM/DD/YYYY")),"0"))
Any ideas?
Thanks!
Ryan Olson
Just cleaned up some bracketing. Let me know how it goes as I didn't alter the formula otherwise.
=IF(VLOOKUP($A3,Sheet1!$B:$D,3,FALSE)="All",
COUNTIFS(Sheet2!$U:$U,Sheet3!$A3,Sheet2!$C:$C,"MM/DD/YYYY")+(COUNTIFS(Sheet2!$R:$R,Sheet3!$A3,Sheet2!$C:$C,"MM/DD/YYYY")),
IF(VLOOKUP($A3,Sheet1!$B:$D,3,FALSE)="One",
COUNTIFS(Sheet2!$U:$U,Sheet3!$A3,Sheet2!$C:$C,"MM/DD/YYYY"),
IF(VLOOKUP($A3,Sheet1!$B:$D,3,FALSE)="Two",
COUNTIFS(Sheet2!$R:$R,Sheet3!$A3,Sheet2!$C:$C,"MM/DD/YYYY"),
IF(VLOOKUP($A3,Sheet1!$B:$D,3,FALSE)="Three",
COUNTIFS(Sheet2!$U:$U,Sheet3!$A3,Sheet2!$C:$C,"MM/DD/YYYY"),"0"))))
I'm looking for a little bit of help learning about how to use vlookup and iferror formulas together.
I am working as a licensing specialist within the insurance industry. My job requires that I frequently access more than a dozen spreadsheets that are emailed to us on a weekly basis from our clients. I am working to develop tools that allow us to consolidate that information on-demand to be able to run reports. I'm having no trouble using the VLookup function to pull data from various spreadsheets using an unique identifier. I do need some help, however, with a trickier formula.
I have put together a spreadsheet that allows me to put in the ID of the representative and it returns various bits of information, such as their name, license numbers, job codes, etc. Now I need to come up with a formula that takes the value returned in the job code field and searches another spreadsheet to return what training they are required to complete based on their job code. This spreadsheet is about 2000 rows, and is formatted with the training names spanning across the top row, job codes listed in column "A" and the word "yes" in each column that matches a training that the job code is required to take.
It looks like this: https://i.imgur.com/71COmfF.png
I need the formula in my reports spreadsheet to lookup the job code using VLookup and then return the column header if the cell has text.
The data will be loaded into this spreadsheet: https://i.imgur.com/2CyFURt.png
Here is the Vlookup formula I am using to get the job code:
=VLOOKUP(B3,'.\[Weekly_HR_Report_040615.xlsx]HR'!$A:$Q,10,FALSE)
How can I pair that same kind of formula with something like an IfError formula to return the column header if there is a "Yes" in the cell of the row that matches their job code?
I know that I can work through it as an array using VBA, but I would prefer to just place a formula in each cell so that I can pass this spreadsheet to another college when I move to a different role in the future and they won't struggle too much with adding to it.
Thanks for any help that you might be able to provide! I really appreciate it!
I would use INDEX and MATCH to cross reference and retrieve the titles where applicable:
=IF(INDEX('JobCode_Training.xlsx'!$A$1:$H$6,MATCH($H$5,'JobCode_Training.xlsx'!$A:$A,0),2)="Yes",INDEX('JobCode_Training.xlsx'!$A$1:$H$6,1,2),"")
=IF(INDEX('JobCode_Training.xlsx'!$A$1:$H$6,MATCH($H$5,'JobCode_Training.xlsx'!$A:$A,0),3)="Yes",INDEX('JobCode_Training.xlsx'!$A$1:$H$6,1,3),"")
=IF(INDEX('JobCode_Training.xlsx'!$A$1:$H$6,MATCH($H$5,'JobCode_Training.xlsx'!$A:$A,0),4)="Yes",INDEX('JobCode_Training.xlsx'!$A$1:$H$6,1,4),"")
etc.
I wasn't sure what your reference table is saved as, so you'll need to replace 'JobCode_Training.xlsx'! with whatever the correct path is.
Since you have multiple trainings that can apply to each jobcode, you'll either need to have multiple cells for the results, or you can concatenate them into one.
The following article from excelvlookuphelp.com answers your question I believe...
The Problem
You might be expecting that not all of your search values are going to return something from the search table. Instead of the formula returning #N/A you’d like the result to look different when your vlookup value isn’t found (either blank or an indicator to show that the value hasn’t been found or a zero if you’re wanting to do maths with the results).
The Solution
You can use the iferror function.
It works like this
= iferror (YourVlookupFormula, WhatToSayInsteadOf#N/A)
Here’s an example
=iferror(vlookup(D3,A:C,3,false), “No Value Found”)
Or if you would rather it was just blank then instead of having No Value Found, just have the two sets of inverted commas, like this
=iferror(vlookup(D3,A:C,3,false), “”)
source: excelvlookuphelp
Afternoon all :)
This is kind of a little difficult to explain but ill happily clarify where ever it is needed. Thank you for taking the time to read this post ^^ Here goes..
I am currently creating a spreadsheet that is been extracted from the database whereby I am tasked to concatenate data from 2 adjacent cells. I change the database on a frequent basis adding or removing data wherever necessary so the range of data is always different. To concatenate the two cells I use the following formula:
e.g: =IF(ISBLANK(B8&H8),"",B8&H8)
This formula works out great when im dealing with increasing amounts of data as I can simply drag the formula down as far as i want and i know that it will pick up the formula whenever I refresh the database without the need of seeing value errors when the formula ends up referring to a blank cell. The snag here (and my query as well) is if I have less data then before the formula within the last set of cells looks something like this:
e.g: =IF(ISBLANK(#REF!&#REF!),"",#REF!&#REF!)
I have dealt with #REF before in other spreadsheets whereby I simply used a ISERROR in the statement but I dont know if there is a possible way of including this within my formula. I need the ISBLANK there so I have more control and dont have to drag the formula as often.
If there is a better way around this or a way to amend the current formula Id appreciate the help :)
The only way you are going to get something like this:
=IF(ISBLANK(#REF!&#REF!),"",#REF!&#REF!)
in the formula bar is if you(or the system you are using) are somehow deleting the cells that were originally referenced. This should be avoidable. You can clear the cells referenced instead of deleting them completely - then you won't get this error - and your formulas will remain intact. Now you can certainly use the formulas provided in the comments to hide the errors - but the root of your problem seems to me to be that the errors are occuring in the first place. Good Luck.