How to make Index & Match functions on GG Sheets match blank cells? - if-statement

I have one table of data (A) with data values, and a second table (B) which serves as a key that categorises/groups those entries into categories.
I am trying to write a cell formula that will list the category that corresponds to the data value in (A).
Some of the entries in the data table are empty, i.e. have no input data.
Case in point:
A13 has an empty cell, according to table (B), I specifically want the blank cell to be categorised as "Other". At the moment the sheet thinks cells like these are "null" and not "blank" and therefore returns #N/A.
I have tried adding an IFERROR function, which works at this stage but does not suit the scenario where a new data entry is entered as that will initially show as "Other" too when it should be something else, so I want to avoid using:
=IFERROR(INDEX(D2:D13,MATCH(A2:A13,E2:E13,0)),"Other")
Current cell formula for col B:
=INDEX(D2:D13,MATCH(A2:A13,E2:E13,0))
Please can you help? I've found plenty of articles on how to ignore blank/empty cells, but nothing to include them.
Many thanks!
OH
Shared link of problem
Screenshot of problem

use ifna like:
=IFNA(INDEX(D2:D13, MATCH(A2:A13, E2:E13, 0)))
update:
=INDEX(IF(A2:A13="",,IFERROR(INDEX(D2:D13,MATCH(A2:A13,E2:E13,0)),"Other")))

Related

ColumnsofType Record not returning any columns

I've got a table full of different data types, including records, that I want to extract all column names of records to then use in an expand function. I've included a screenshot of a column containing record's however, when I use this = Table.ColumnsOfType(#"Expanded fields", {type record}), it returns an empty list .
I've tried looking through the entire column to see if there was anything different but its all record types. Any help please.
EDIT:
Error using Table.TransformColumnTypes
Record is not a valid type to search for. And judging by your image, your type is Type.Any as denoted by the ABC123
You best bet is to unpivot all the columns (perhaps those starting with a certain prefix) then on the new Value column, expand like so
#"PriorStepNameHere" = .... ,
ExpandList= List.Distinct(List.Combine(List.Transform(Table.Column(#"PriorStepNameHere", "Value"), each if _ is record then Record.FieldNames(_) else {}))),
Expand= Table.ExpandRecordColumn(#"PriorStepNameHere", "Value", ExpandList,ExpandList)
It sounds like the Table.ColumnsOfType function is not properly identifying the columns in your table that contain records.One possible reason for this is that the column's datatype is not properly set as 'record'. Another possible reason could be that the data in the columns is not structured properly and hence it is not being identified as a record. You can try to use the Table.TransformColumnTypes function to convert the column's datatype to 'record' and see if that resolves the issue.
If the issue still persists, please share the sample data and the code you are using.

In Google Sheets, how do I search for a value in lists in multiple sheets, and return a result if there is at least one match?

I have a sheet with a list of company names in column A - some of these company names are present within sheets of different users, who have a tickbox within a column beside these companies.
I want to have a column in my sheet which would tell me whether this company is ticked within one of the user's sheets and if so, put the user's name in the cell next to it. If not, it can remain blank. The likelihood at this time that the tickbox is TRUE for the same company in two different sheets is negligible.
In the sample sheet below, I've used the following formula in cell B2:
=ifs(vlookup(A2,Sheet2!$A$2:$B$11,2,false)=TRUE,"Sam",vlookup(A2,Sheet3!$A$2:$B$11,2,false)=TRUE,"Nick",vlookup(A2,Sheet4!$A$2:$B$11,2,false)=TRUE,"Mike")
It works for the first two conditions, but then it cannot seem to work with the third logical pair. Note that the sample sheet below uses the vlookup across tabs, the actual sheet will be using importrange, but I don't think it should make a difference.
What could be wrong?
Sample sheet here
A More General Problem
To make this more general so others find it useful (which is the whole point of StackOverflow), the general problem can be rephrased as
"How do I search for a value in lists in multiple sheets, and return a
result if there is at least one match?"
Generally, when using VLOOKUP(), QUERY(), or other matching functions, you have to account for any errors through non-matches. Those "move" outwards into the outer functions and can eventually be the reported result, unless explicitly handled. Sometimes, this is less obvious when you sometimes get answers but that's because the outer functions have ignored or not evaluated the matching function.
Therefore, always consider what happens if the matching function returns a N/A and explicitly handle it.
Your Example
In your case, IFS() is simply raising an error whenever VLOOKUP() does not match. However, since IFS() returns the first condition that matches, from left to right in the formula, it doesn't always get around to evaluating one of the non-matching VLOOKUP()s which is why you see it works sometimes.
So, you should explicitly handle the errors with e.g. IFERROR()
My approach was to avoid lookup functions, and just filter the list by those that had filled checkboxes, and then count the occurrence of interest ("Company 1", "Company 2", ...) using COUNTIF(). If the counted total is 1, we have a match, so grab that entry as an element in an array. Otherwise, leave an empty value.
At this point, you could drop the empty elements, and take the first non-empty element (or return a blank), but I opted to list out all of the names.
To get rid of the blanks, I use QUERY() and then JOIN() to make a list of each name. In the case, where nothing matched, and my array was empty, I simply wrap everything in one IFERROR().
=IFERROR(JOIN(", ",QUERY(TRANSPOSE({IF(COUNTIF(FILTER(Sam!A:A,Sam!B:B=TRUE),A2)=1,"Sam",""),IF(COUNTIF(FILTER(Nick!A:A,Nick!B:B=TRUE),A2)=1,"Nick",""),IF(COUNTIF(FILTER(Mike!A:A,Mike!B:B=TRUE),A2)=1,"Mike","")}),"SELECT Col1 WHERE Col1 IS NOT NULL",0)),"")
I found it convenient for your example to rename "Sheet2" as "Sam", "Sheet3" as "Nick", "Sheet4" as "Mike", which is what I think was your original meaning.
The formula can be easily modified to show just the first matching result.
use:
=ARRAYFORMULA(IFNA(VLOOKUP(A2:A, QUERY({
QUERY(Sheet2!A2:B, "select A,B,'Sam'");
QUERY(Sheet3!A2:B, "select A,B,'Nick'");
QUERY(Sheet4!A2:B, "select A,B,'Mike'")},
"where Col2=TRUE"), 3, )))

Creating a formula using INDEX and IF

I want to create a formula where I take the newest value on a cell. The information is updated when someone fills out the Google Form. Basically, there is some information the customer might not fill out, so the information is sparse.
What I want to create is a formula where it always takes the very bottom value of the spreadsheet (newest information). Even if the cell was blank, I want it to output as blank, and if there is an information on that cell, output it as that written value. Is this possible using INDEX and IF formula? Or is there some other formula to solve this problem.
If this doesn't make sense, please comment and I'll answer.
=INDEX(A:A, COUNTA(A:A))
let form sheet be:
then to get last form entry row use:
=ARRAYFORMULA(INDIRECT("form!"&
MAX(IF(form!A:A<>"", ROW(form!A:A), ))&":"&
MAX(IF(form!A:A<>"", ROW(form!A:A), ))))

How to select multiple values from a filter in Google Sheets?

I've got lots of data in a Google sheet (I do not have Excel or Windows as I am on a Chromebook) and I want to use one column to filter out cells which contain two different words. The column of data might contain various values.
Example
Cell 1 Acme - Main - Location
Cell 2 Acme - Secondary - Location
Cell 3 Acme - Location - Main
Sticking with the above example, I would like to use my data filters set at the column headers to only show me cells where it matches Acme and Main.
What is the best way of doing this, please?
I tried using the Text Contains option in the data filter but I'm not sure how to insert both words as something to filter by, it seems to only filter the words exactly how they are typed. So if I type in Acme Main into the filter it will work for some cells which are in that exact order.
if the order of "acme main" combo does not matter you could use:
=REGEXMATCH(A1:A, "Acme(.+)Main|Main(.+)Acme")
if you also want it by any chance case-insensitive use:
=REGEXMATCH(LOWER(A1:A), "acme(.+)main|main(.+)acme")
In the filter options, use this custom formula
=regexmatch(A1:A, "Acme(.+)Main")
and see if that works?
Change column reference to suit.

How to put formula in Data Validation List Excel?

I am creating an excel sheet with following Data Validation drop down list.
NA
Done
(add some formula here)
Basically, i will be able to select either plain text "NA"/ "Done" from the dropdown list. But sometimes, I want the user to be able to calculate some values based on the cell respective to the row selected so, I want to have one formula as a choice inside the data validation dropdown list. Is this possible?
Data Validation List Source
When I click on Formulae option, it should execute the formula with respect to the cells in that Row
But currently, the formula that i put in doesn't execute, instead it will just show the whole formula in the cell when activated.
1)How can i make it so that when i select the formula from data validation list, it will execute it instead of filling up the cell with it?
2)How do i set the formula so that it will be using the cell from the current Row? (for example, if i am using the data validation List in N60, the formula should adapt itself to use the cell (let's say A60?).
I may not be able to help with the second part, but I was seeking an answer to the first and discovered a solution/workaround using Name Manager.
First, in Formula > Name Manager, create a new reference (the "refers to" will contain whatever formula you are wishing to ultimately display in the validation list. For this example, we use the formula reference "=IF($H54=..." and Name it "UniqueName"
Now, we go into Data Validation, Select List, and input the three items we want displayed in the list, with an equals sign preceding our newly named reference: ie. "NA,Done,=UniqueName"
Note: You can't start with the =UniqueName or validation will try to read it all as a formula and fail.
This method will allow the user to display "NA", "Done", or "=UniqueName" in the cell; if "=UniqueName" is selected, the cell itself will interpret this as a formula and execute it accordingly, displaying the results of "=IF($H54=...", or whateverelse you have designated to use as a named formula.
If it's too late for yours, I hope this helps someone else who may face a similar problem.
While I think I know what you're trying to say. Why don't you just use an IF formula to evaluate everything instead of selecting a drop down for every row manually. You already had it partially solved using IF. Just need to add the criteria for a "Done" and an "NA"
=if(A1="date","Done",if(A1<"date","NA",if(something else until you have all your catergories))
Just going to piggyback off of Mark's response.
If you really needed your named formula to be the first selection in the list, you can setup your list with a leading comma like so:
,=UniqueName,NA,Done
That worked out for my use, and there was no null item listed in the Data Validation drop down. Hope that helps!