Using If Statement in Excel to populate when typing in a cell - if-statement

I'm trying to find out if I can make a formula where I type in any value in a cell and then the next cell autopopulates with the city. Basically it will just be an address field for customers and the city will always remain the same. I just want it to be able to be blank if there is no data in the cell before it and if there is something typed in there it will populate the city in the next cell and the state in the next.

=if("a1"="","","city name") This is an if statement that is checking if the designated cell is blank and if it is then it will show blank, if there is something in there, then it will populate with what you have in "city name"

With “a cell” being in ColumnA (staring in A2), your city in B1 and State in C1 (they may already be labels) then:
=IF($A2="","",IF(ISEVEN(COLUMN()),$B$1,$C$1))
copied across one column and down may suit. If the resulting sequence is the wrong way round then either change EVEN to ODD or switch the contents of B1 and C1.

Related

Copy and Filter out selected fields from 2 tabs in the Same Gsheet to another Tab with common category Fraud = 'Yes'

Copy and Filter out selected fields from 2 tabs in the Same Gsheet to another Tab with Fraud = 'Yes'
I have 2 sets Tabs in the Same Gsheet with different information. I would like to copy them into another tab with Fraud ="Yes". I have an example with formulas in Combine Example from Stall A Example and Stall B Example with some help previously. When I tried to replicated into my actual data (Combine NSU and ACH ) set I can't do it.
Can someone please help and guide on this.
https://docs.google.com/spreadsheets/d/1N35wUB-a7hDHFTzdhajlaCTJf_Ce34Ql3Miwq51JCqY/edit?usp=sharing
Whenever it is Fraud = "Yes", it extracts the necessary information from NSU Tab and ACH Tab with has Fraud = Yes into Combine NSU and ACH Tab
#=SORT(
LAMBDA(DATA,
LAMBDA(DATE,TYPE,AMOUNT,FRAUD,ID,ERP
FILTER({TEXT(DATE,"dd/mm/yyyy"),TYPE,AMOUNT,FRAUD,ID,ERP},FRAUD="YES")
)(INDEX(DATA,,1),INDEX(DATA,,2),INDEX(DATA,,8),INDEX(DATA,,13),INDEX(DATA,,15),INDEX(DATA,,16))
)({'NSU'!A2:P27;{'ACH'!A2:A8, 'ACH'!B2:B8,'ACH'!N2:N8,'ACH'!L2:L8,'ACH'!F2:F8,'ACH'!H2:H8 }})
,1,TRUE)
Code:
Output:
Get all data of sheet NSU and ASH, and re-arrange their orders by QUERY.
Group them up with another QUERY to filter the data you want such as Col4 = 'Yes'.
All the formating and sort can also be done with query.
=ArrayFormula(
LAMBDA(NSU,ACH,
QUERY({NSU;ACH},
" WHERE Col1 IS NOT NULL "
&" AND Col4 = 'Yes' "
&" ORDER BY Col1 ASC"
&" LABEL Col1 'Date',Col2 'Type',Col3 'Amount',Col4 'Fraud',Col5 'ID',Col6 'ERP' "
&" FORMAT Col1 'yyyy-mm-dd' "
)
)(
LAMBDA(COLS,
QUERY({NSU!$A:$P},
" SELECT "&JOIN(",","Col"&COLS)
&" LABEL "&JOIN(",","Col"&COLS&" '"&REPT(" ",COLS)&"'"),1)
)({1,2,8,13,15,16}),
LAMBDA(COLS,
QUERY({ACH!$A:$N},
" SELECT "&JOIN(",","Col"&COLS)
&" LABEL "&JOIN(",","Col"&COLS&" '"&REPT(" ",COLS)&"'"),1)
)({1,2,14,12,6,8})
)
)
Well, in-case you really want to have the ability to add some input fields in-between the output QUERY.
The answer is you can't, but also you can.
Basically, you cannot insert anything in-between any kind of array outputs in google spreadsheets, the array-formula will return an error '#ref' mentioning that there are other values inside the output range which fail it from showing the output, BUT...
you can always get around this issue by simply seperate the output array by an other QUERY, such as:
This simple array in google sheet will reference range A1:C10 and place the data into where-ever you type this formula into, which output a 10 rows by 3 columns array.
={A1:C10}
We assumne that you put this in cell 'E1', that makes the output covers range 'E1:G10'.
If you what to have a column of fields which allow you to input new data in-between the output range, for example, you want to add a new column in F:F.
In that case, you can put 2 formula seperatly into cell 'E1' and cell 'G1', which contains the following formulas:
in cell 'E1':
=QUERY({A1:C10},"SELECT Col1")
in cell 'G1':
=QUERY({A1:C10},"SELECT Col2,Col3")
Since the output arrays are seperated, that makes the column(s) between the column E and column G a normal empty column, which allows you to input anything into the cells.
The beauty of QUERY function is that you can select any column(s) of a given reference array as an output.
In this case the output data will be seperated into 2 parts, one contains only the first column of the reference, the second one contains the rest of them.
It doesn't matter how many empty columns you insert between the 2 outputs since they are 2 outputs of one identical reference.
The draw back is, if your reference data are results of calculations, the sheet will have to do all those calculations two times, even if they gives the same results, which is why I say this can and will slow things down and are not very recommended.

UNIQUE formula in Google Sheets for multiple ranges

I have a list of participants in column A. A full employee list in column B. I want to get the list of non-participants in column C. Basically 'B-A' but in list form.
'January' is the participants list:
try:
=FILTER(A:A; NOT(COUNTIF(B:B; A:A)))
It is always an added challenge to write formulas when we don't have access to actual date. But based on what I can see, try this formula in the top cell of any empty column:
=ArrayFormula({"My Header"; FILTER(R2:R,ISERROR(VLOOKUP(TRIM(R2:R),TRIM(T2:T),1,FALSE)))})
You can change "My Header" to something meaningful.
The next part means "FILTER in anything in the range R2:R that cannot be found [i.e., ISERROR(VLOOKUP(...))] in T2:T."
TRIM is used just to account for any accidental/stray spaces that may occur in either list, since that would result in no match if one or the other had extra space.
If this does not do what you expect, please share a link to a sample spreadsheet.

Input text in one column (a) if the value in another column (b) is found in another column (c)

I have two lists of people - they will not be sorted in the same order. The second list is in a different sheet. If the person listed in column A shows up in Column A in the second sheet, I want column F to display "Y." If not, I want column F to display "N."
This formula: =ArrayFormula(vlookup(A2:A,Attendees!A2:A,1,0)) almost gets me there, but I can't figure out how to get it to return Y/N instead of the name of the Attendee or not.
Any ideas?
try:
=ARRAYFORMULA(IF(IFNA(VLOOKUP(A2:A, Attendees!A2:A, 1, 0))="", "No", "Yes"))

How to populate a VLOOKUP with a dynamic range in Google Sheets?

I have a file that needs to look up the team name (on a tab called "Parse") of an employee on a tab called "Roster". This can be done with a simple array Vlookup, however, the issue is that each week, we add a row to the Roster tab because employees sometimes move around.
I have already done the majority of legwork by using a MAX/FILTER/COLUMN, LEN formula to determine what the last column is in the Roster tab. I have also created a range that will provide me with the actual range needed for the VLookup. For example: If the last column in Roster is "G", I already have a formula that populates "'Roster'!A2:G", which is the range I would need for my Vlookup. If the last row in Roster is "P", then the formula shows "'Roster'!A2:P".
The formula that gives me the range, as I described in the examples, lives in cell F2 on the Parse tab.
So the hard part is done. All I need to know now is, when writing my Vlookup, how can I have the formula reference the actual contents of cell F2 in the Parse tab instead of thinking the lookup range is cell F2. Here's a visual:
Cell F2 in the Parse tab reads: 'Roster'!A2:G (because as of now, column G is the last column with data. this is correct).
My VLookup is VLOOKUP($A2,$F$2,7,FALSE). However, I want my Vlookup to say VLOOKUP($A2,'Roster'!A2:G,7,FALSE).
Is it possible to have the formula reference what is IN cell F2 instead of referencing just "F2"?
I hope this made sense. It's the end of my workday and I'm very tired.
try something like:
=VLOOKUP(A2, INDIRECT("Roster!A2:"&
SUBSTITUTE(ADDRESS(1, MAX(IF(Roster!1:1<>"", COLUMN(Roster!1:1), )), 4), 1, )),
MAX(IF(Roster!1:1<>"", COLUMN(Roster!1:1), )), 0)

Searching for unmatched ntheames when comparing spreadsheets

In one spreadsheet I have 3 columns with a first and last name of a person combined. In the 2nd spreadsheet, I have column a = first name and column b = last name.
I want to know which names in spreadsheet one cannot be found in spreadsheet two. I also need to verify the data to make sure that the formula was accurate on finding the correct lookup.
Do I have to combine my columns in spreadsheet 2 to make the first and last name in the same column to make this work?
Which formula would you use for either scenario?
Use this:
=ISNA(MATCH($A1&" "&$B1,Sheet2!$A:$A,FALSE)))
Where (in order):
A1 is the first name column in Sheet1
B1 is the last name column in Sheet1
Sheet2 is the sheet that has the data stored as names separately
$A:$A is the rows that have the two names together
FALSE is because it's an exact match
This will return FALSE if the element does not exist, and TRUE if it does
You can also use:
=VLOOKUP($A1&" "&$B1,Sheet2!$A:$D,3,FALSE)
If you want to retrieve data for a match.
Finally, if you need to do your lookups the other way, take a look at this thread for some ideas on how to split the string into two pieces.