Match number and list column headings in one cell - vba

I have a worksheet that has a summary sheet which keeps all the data and several other data sheets that are used to confirmed the information. I like to match the identifying number on the summary sheet with the number on the data sheet and list the column letters, in one cell, where the condition is not met.
Also the data sheet will be updated which will affect the result of the conditional statement but I want to be able to preserve the historical result of the first results.
*The identifying numbers are not unique but there should never be a situation this would cause different data to be returned.
Is this possible?

Related

Match, pull and add numbers from different cells on a different sheet

I have data on 'JobSheet1' in Column D, I have Invoice Numbers in ascending order (some are repeated for different products on same order), in Column E, I have amounts i.e £50.00.
On a second sheet 'InvoicesSheet1' in Column B, I have the invoice numbers and Column C is where I would like the total for each invoice number to appear.
Can anyone help with very simple VBA or a formula that will search for the Invoice Number its sitting by in 'JobSheet1' Column D and add all the matching invoice number totals from Column E.
Scott Craner is right, with the schema you described, you will get the result you want entering into cells Ci:Cj (where "i" and "j" are
the start and end of your table, respectively):
=SUMIFS('JobSheet1'!E:E,'JobSheet1'D:D,B{i...j})
If this doesn't work, likely issues you need to watch out for would be:
Sheets are not named exactly as you typed here. Maybe they have a leading or trailing space.
Your copy of Excel/Windows may be set with a different regional setting, which requires that formula parameters be separated by semicolons (;) instead of comas.
Your invoice numbers may not be typed precisely the same in the two different formulas.
Your amounts in column E may not be stored as numeric values. You can test for this by selecting a few values from column E - if excel doesn't show their sum and average in the bottom right corner, they are stored as text and you can't perform math operations on them.
I'd need to see your data to see what could be the issue, but that's not what this forum is for - Try constructing a new table with dummy data set up exactly as you described it here and try using this formula, to verify if it works. Then, adjust accordingly as needed.
Assuming you're first invoice number in InvoiceSheet1 is in cell b3, you can use:
=SUMIF(JobSheet1!D:D,InvoiceSheet1!B3,JobSheet1!E:E).
If it's in another row, replace InvoiceSheet!B3, with the relevant cell where your data starts. Copy down the formula for the other invoices
SUMIFS is not necessary with just one lookup condition.
I solved this by amending the SUMIFS suggestion from ScottCraner and this is what I ended up with
=SUMIFS(Jobs!K:K,Jobs!A:A,D3)+SUMIFS(Jobs!L:L,Jobs!A:A,D3)
Does the job!

Find first non-blank cell in column that meets criteria in another column

I've compiled multiple spreadsheets containing sporadic employee information, and I'm now trying to consolidate all of the information to remove duplicates and blanks. The formula below is my starting point, but if the first cell that meets that criteria is blank, it returns a blank. I want it to find the next cell that meets that criteria but has a value.
=INDEX(Working!C:C,MATCH($A3,Working!$B:$B,0))
Below is what the Working tab looks like, which contains the master list of data including blanks and duplicates. Working!C:C is the list of last names; $A3 is the Employee ID I'm hoping to retrieve data for, and Working!$B:$B is the list of Employee IDs. I'll be doing this for many columns, so to illustrate this, in the table example below I've shown that Column D is the phone number. Any help you can provide is appreciated!
Column B-------C-------D
---------287-----Doe----blank
---------287-----blank---333-333-3333
---------287-----Doe----blank
Use the following array formula:
=INDEX(Working!C$1:C$100,MATCH(1,($A3 = Working!$B$1:$B$100)*(Working!C$1:C$100<>""),0))
Being an array formula it needs to be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode. If done correctly then Excel will put {} around the formula.
Please note that with an array formula the references need to be the smallest range possible that covers the dataset.

Excel - Can not compare two spreadsheets

I have gone through V-look-up guides online but I can not find one that explains what I am looking for. I am trying to avoid manual checking.
What I have:
Two sheets, Sheet 1 and Sheet 2. Both sheets have the same column names (A1:G1) with multiple rows.
Sheet 1 contains my spreadsheet where I update daily. Sheet 2 is the same spreadsheet that is imported from a application (but has hourly updates). Data can change in each row (for some columns) along with additional added/deleted rows. The data is text, dates and numbers (mixture of both too).
I want to run a formula to highlight the changes on sheet 1 (grabbing the updates from sheet 2. Once I find out the formula works correctly, I would like to know how to replace the Sheet 2 updates onto my spreadsheet (Sheet 1).
I am looking for a formula outside of creating a macro (worst case scenario).
Currently I have the following vlook up formula:
=VLOOKUP(A1,sheet2!$A:$A,1,FALSE)
When I run this in another column (lets say in H1 in Sheet 1), it will display "N/A" if that column (A1) in Sheet 2 is not the same. If it is the same, it will write out the column name.
When I use the following formula highlighting all the cells in Sheet 1, I get a values error:
=VLOOKUP(A1:G33,Sheet2!$A:$G,1,FALSE)
How could I apply that formula to the whole spreadsheet (I guess it would apply to both sheets) and have it highlight records in my spreadsheet (Sheet1). Could it also highlight rows that are missing or added?
The data in Column 1 and 2 would never change (they are ticket numbers). Only change that can apply is if ticket is closed, so when I import the updated spreadsheet that row isn't there anymore. If you think there might be a better way to tackle this down, I would like to hear.
Please let me know if I am not clear.
Here are some example screenshots:
Just in case, the formula for the totals are (adjusting the columns for each):
=SUBTOTAL(3,INDEX(C:C,2):INDEX(C:C,ROW()-1))
Sheet 2 is setup very similar. When I import it into excel, the columns are the exact same as Sheet 1, the only difference can be more/less rows (along with the updates for each row).
You can use conditional formatting.

How to look for a value in a sheet, but it may be in different columns, and the copy pasted in another sheet if match some criteria?

here is my issue.
I have 2 sheets in the same workbook that share a common criteria (po#).
*Sheet1: contains the information that has to be filtered and divided according to sheet3... that is if the PO# in sheet1 match the po# in sheet3 then the whole row should be copy and pasted in a "sheet4" if meets some criteria ("market" that could be jet, bigcommerce, amazon). Here is where it gets more complicated...
1-the po# in sheet3 is in the first column (A), but the po# in sheet1 is in column A or B.
2-The idea is to have one sheet for each market.
So excel should look for the po# first, and the if its there, look for "market" and copy paste all the records that share the same market in another sheet.
*Sheet3: contains po# and some other data.
--Other user asked a similar question (find record and copy pasted in another sheet) but the answer is based on the lookup value being in only one column (as opposed to my case where it may be in A or B). how can I make it look in both columns?
Thank you!
Because your two search columns are in the same data table as your results, your solution is actually quite straightforward, using a combination of the INDEX & MATCH functions. INDEX pulls in the value for a column, for a specified row #. MATCH provides the row number, where a search term was found in a column. Together, they work like this, pulling in the amount in column D, for the row where column B matches the search term in A1:
=INDEX(D:D,MATCH(A1,B:B,0))
For your case, you simply need to use IFERROR to first try to match the search term in one column, and then if no match is found, try to match the search term in a second column. Put this formula in your sheet1, starting at B2 [assuming no headers], and then drag down and to the right:
=INDEX('Sheet3'!B:B,IFERROR(MATCH('Sheet1'$A2,'Sheet3'!$A:$A,0),MATCH('Sheet1'$A2,'Sheet3'!$B:$B,0)))

VLOOKUP on first and last name with no unique ID

Situation:
I have two sheets: The first sheet contains a list of employee names; the second sheet contains a piece of a pay report for employees. I need to pull the employee pay data from sheet 2 to sheet 1 by searching for the employee on sheet 2. What complicates this is the report on sheet 2 contains changing employees, pay, and has no unique ID.
I am looking to fill in column A. I cannot permanently modify this sheet as it affects downstream reporting.
I split column B which was previously first name, middle initial (if any), last name. Note, about 10% of the names may have a different last name. For example, sheet 1contains the name Tara Feather, but the second report uses her maiden name of Tara Bird.
Attempts so far:
I am new to Excel, and am just learning VLOOKUP. My first attempt was to pull the data based on the last name column on sheets 1 and 2, and enter data. Unfortunately, while that worked for 90% of the entries, the last 10% had the wrong values and the audit to correct took more time than manual entry.
Possible Ideas:
My next thought was to combine an If statement and VLOOKUP so that if last name matched, and first name matched, then execute the VLOOKUP and pull values, or enter "ERROR".
With this new thought, I don't know if I'm now in macro territory or if there are a combination of functions that can help. Ideally, the more it can do with 100% accuracy the better. However, if it can highlight the names it completed on sheet 2, I can always enter the non-highlighted manually, still saving time.
What are your thoughts and direction?
You want 100% accuracy, but if someone has different names on the two sheets, then that's never going to work.
So to get 90% of it right:
On the second sheet put this formula in G2 and copy it down for as many rows as you have names.
=B2&D2
Put this formula in H2 and copy it down
=F2
On the first sheet put this formula in A2 and copy it down
=VLOOKUP(D2&C2,'second sheet'G:H,2,false)
Any rows where it can't find a matching firstname and surname will have #N/A in them.
Assuming you can modify the second sheet permanently you can put the right surnames in so that the formulae work. You could also put in the middle names into the formulae in case you have two people with the same names.