Morning all my first post here, need some advice on a complex formula. I do not code - no VBA, no macros. Working in a massive hospital company and focused on process improvement. as such lots of compliance concerns and will have to dummy up data if example sheets are needed.
The short version - i have a weekly project that runs on a template I built. It works well currently. I have a monthly report that this weekly project compares to and pulls data from. The monthly report is incredibly heavy - not less than 1000 lines of data, and I index one of two data points from it, based on a match of one of eight columns. I've gotten an index/iferror/match formula working to capture half of the data. However i am stumbling on what should in theor be the easiest part.
The desired outcome is on the weekly tab in column D - the formula needs to evaluate first whether the value in WEEKLY column C "type" is "I" or "O". Then based on that result, the index/iferror/match which change the index from MONTHLY column U to MONTHLY column V.
Currently the formula i have works as an index on MONTHLY column U, and properly evaluates whether WEEKLY A, or B, or C, or D, or E or F or G or H is matched. When I wrap the whole thing in an "IF([#[Type]]=I,INDEX...) then it immediately errors. Any advice is appreciated. Screenshot of "WEEKLY" and "MONTHLY" below with a copy of the current half-effective formula in the weekly column D slot for reference.
enter image description here
Related
I am very new to VBA, having compiled my first two macros only two days ago for the purpose of bank statement reconciliation. My issue though is that I've realized the next step is too complex for me to code myself, and I can't seem to find adaptable code.
I need to take a name, find it in a master file of about 600 names, and see whether it finds a match. The problem them is, frequently there will be two or more individuals with the same name that were either paid different amounts, or were paid the same amount.
I am looking for some help on how to approach this, what functions I would need to use and whatnot. Alternatively, if someone were willing to write this macro for me, I would be happy to Venmo them $10 for the help (by sending your handle to a temp email), as well as of course put a tick next to their answer. I've laid out logical process as I envision it below.
As the data is proprietary, above is a quick example of the data I made. On the left, we have the cleaned bank statement data, with the names in one column and their corresponding salary amounts in the next column. On the right is the master file where we want to reconcile. First off, we are searching only first names as that's how they show on the bank statement, they're Afghan names so the most duplicates we'd get is ~7. Second, a quick note is that the search needs to take place by period, which is a number from 1 to 9 in a column where a number corresponds to a month/bank statement. Here is the logical process:
Take name, i.e. John, from column D in the left spreadsheet (AKA statement), and search through names in column G in the right spreadsheet (AKA master file).
For each name (in period 1): does name match?
If no, keep cycling until a match is found.
If no match is found, move on to next name in statement.
If yes, does the salary amount in column E of statement match with that name's corresponding salary amount in column AV of master file?
If no, keep cycling through all of the names in master file until either a salary amount match is found, or move on to next name in statement.
If yes, it does match, continue to cycle through all names in the master file to check whether there are any other individuals with the same name, and if so, whether one or more of them were paid the same amount.
If an individual does not share their name with anyone else, and the salary amounts in both spreadsheets match, put an "a" in column X.
If an individual shares his/her name with one or more others but his/her salary is unique, put "a" in column X.
If 2 or more individuals with the same name were paid the same amount, put the COUNT of these individuals in column Y. (just marking the instance with a "b" in column Y would be okay too). Ideally, this count would be put next to every instance that 2+ individuals with same name paid the same amount was found.
It looks like the code might be pretty clunky and slow, but all I need is for it to work, doesn't need to be efficient, given that it's all terribly tedious to do manually.
Any help with this would be extremely appreciated.
Based on your description and screenshots, it looks like you can solve this relatively easily with two COUNTIFS formulas (no VBA required). In the following example, I'm going to assume that your cleaned bank statement data is in a separate excel workbook named "Bank Statement.xlsx", and the period data in your master file is in column "A":
The first step is to compare the First Name (column G) and Amount Paid (column AV) in your master file to the data range in your bank statement file (column D and E respectively) and count the number of times both are a match (anything greater than 0 indicates a match). In your master file, type the following formula in cell "X2":
=COUNTIFS('[Bank Statement.xlsx]Output'!$D$83:$D$88,G2,'[Bank Statement.xlsx]Output'!$E$83:$E$88,AV2)>0
The second step is to find any duplicate records in your master file where the Period (column A), First Name (column G) and Amount Paid (column AV) are the same. In your master file, type the following formula in cell "Y2":
=COUNTIFS($A$2:$A$6340,A2,$G$2:$G$6340,G2,$AV$2:$AV$6340,AV2)>1
The third step is to check if both conditions are TRUE. Insert another column in your master file (column Z) and type the following formula in cell "Z2"):
=AND(X2,Y2)
The final step is, of course, to copy the formulas in cells X2, Y2, and Z2 all the way down to the bottom of your data (row 6340). You can now filter by column Z to show only records with a value of TRUE.
Please note the position of the dollar ($) signs in the above formulas. They are essential to maintain the proper range references when copying the formulas down to the bottom of your data.
Hopefully you can adapt this example to fit your actual excel workbook.
Cheers!
I need to create a module that will count the amount of values in specified date ranges, with other criteria.
For example, I have a list of products (Products A, B , C, D) in column C, and their sale date in column G.
I need to count all of product A sold before 1/1/1998. I then need to calculate product A sold between 1/1/1998 and 1/1/2005 etc.
I need to be able to run this for all the types of products, and group products together.
E.g. count all of product A & B sold before 1/1/1998.
This has to be done for a new workbook on a weekly basis so ideally needs to be able to be run for a new workbook each week. The tab names always remain the same.
Any help on how to get started would be appreciated
This answer will assume that your dates are entered as excel dates in column G and not a text. You can test this by using the formula =ISNUMBER(G3) where G3 is one of your dates. If it returns true, then your date is properly stored for use by excel formulas and this answer.
=SUMPRODUCT((($C$1:$C$100="A")+($C$1:$C$100="B"))*($G$1:$G$100<Date(1998,1,1))
That is how to hard code it. Personally I would build a table. Each row of the table would be a product you are interested in knowing the count for and a sum of the count would give you combined totals. Repeat the table if you need multiple combinations.
In the following example a single product was counted and then the total for all products listed was the total. The formula for the example in L3 and copied down for each product was:
=SUMPRODUCT(($C$2:$C$9=$J4)*($G$2:$G$9<K4))
The total at the bottom of the table was a simple SUM formula. Because SUMPRODUCT performs array like operations, avoid using full column references and try to restrict it to the data that needs to be checked. Otherwise you may notice a slow down in your system as multiple excess calculations are being perfomed.
I'm trying to fill out a sheet with a somewhat complicated criteria, I have four columns I'm interested in, however the columns are mixed into a much larger table, sorry vlookup :(
There are two columns that contain an ID# and a Category, one column with date and time stamp, and one that MAY contain a date and time stamp. (Column1,2,3,4 respectively)
Column 3 is when an action took place, Column 4 is the next time that action with the same ID# and Category has to have been completed by.
Essentially I need a cell(s) that will check for a date in Column 4, if there is one, find the next value in Column 3 that is greater than that of column 3 in the row with the value in Column 4, AND has the same ID, AND Category and compare them to see if it was done on time, preferably also by how much if it was late.
I'm able to find it almost with:
{=MAX(IF([#[Column 2]]=[Column 2],[Column 4]))}
Entered as an array formula, however that will only give me the last time that Category was given a "Next Due Date" and similarly with Column 1 replaced for Column 2 in the code sample above, I only get the last time that ID# was given a "Next Due Date".
As some Event ID# can be around for many days, and can run concurrently with others there's no guarantee all IDs will be grouped, nor Categories within those IDs.
It appears any attempts to add an AND(.. function break the array, though I'm not positive I'm not just messing up the placement of it.
It's perfectly fine if the solution involves creating helper cells.
The table is sorted chronologically by column 3 with the latest date at the top if that's any help.
TYVM for even taking the time to read this :)
Edit 1:
Sample Data
I've included an image with some sample data, to clarify the awkward sentence above. The orange arrows are pointing to two dates that would be compared and the event was late. the Green points to a group that was on time.
the categories are
Those two are being compared because each set has the same category, and ID. I hope that clears it up :)
You could try this formula (goes into column E):
=IFERROR( IF($D2<>"", LOOKUP(2,1/($F1:$F$2=$F2),$C1:$C$2), ""), "")
Very important here are the $ signs, as the searched area is supposed to move with the row. (Note: this formula goes into E2. You then copy > pastespecial (only Formulas) it into the rest of the column.)
My table looks like this:
A B C D E F
ID Category Start-date Due-Date Completion-Date ID+Cat. (Helper column)
The formula in F is simply =$A2 & $B2. The data starts in Row 2.
You will need to replace the columns with yours.
Please let me know if this is what you were looking for.
I have a question regarding excel and I am looking for a formula that can help me transport my data from one sheet to the other. I have some experience with excel, however I am not a pro at it, so I apologize if this is a very trivial question but would also be happy since that would mean it probably has a very trivial answer! Unfortunately I do not have enough reputation points yet to post images, but I will try to explain it as clearly as possible.
Basically I am creating an excel template and the goal is to have 2 sheets in excel.
In the first sheet I have a column with following input in rows A1 - A3: Sales Region,
Country, Account ID's.
Above is the example of column A; from column B --> x; I will put e.g.
Americas, US and as many account numbers as there are in that specific country.
However on the second sheet it gets a bit complicated. My goal is that all the account numbers from sheet 1 irrespective of their sales region and country (which also means irrespective of their column) will automatically be listed on the second sheet.
The second sheet will be organized in the following way:
From column A - C; sales region, country and account ID.; from column D - x financial information for each account.
As a first step I want all the different account ID's from the different columns on the first sheet to be listed under column C (account ID's) on the seconds sheet.
As a second step I want column A - B to be automatically filled out according to account number by accessing the information in which column and thus sales region and country the account is in on sheet one.
I don't think a simple vlookup would do the job, especially for step 1, since I want the account ID's from many different columns and rows in sheet 1 to be listed in just one column....
hope it is clear enough! Would appreciate any help! :) thanks in advance!
The first step take all of column A and copy it to the 2nd sheet on column C.
Select data ribbon and select remove duplicates.
For column A insert vlookup for column C for all the data in 1st sheet
For column B insert vlookup for column B for all the data in 1st sheet
Those value will work well only if an ID has one valid Region and country.
Now just use custom sort to sort it in the way you desire.
I tried to summarize the idea of my question in the title, but it sounds a lot more complicated than it really is...
For anyone that doesn't know, Bloomberg is a data service provider where you can extract prices for various financial assets (and other things) into MS Excel. The format is quite typical: data is usually arranged in a time-series with dates progressing down rows and various financial products progressing across the columns.
Example: Historical prices for the S&P500 and DAX will appear in columns B and C,
respectively. The date for each price will appear in column A.
A B C D
DATE S&P500 DAX 'Formula'
02-Jan-14 1,462 7,778 = B * C
03-Jan-14 1,459 7,756 = B * C
04-Jan-14 1,466 7,776 = B * C
As time passes, the list gets longer with new prices, in this case the next price
for 05-Jan-14 would appear (actually the 7th is a Monday).
The problem arises when I have an Excel formula in column D that refers to either columns A, B, or C. As the days progress and the list of prices/dates grows longer (i.e. more rows), the formula in column D doesn't grow with this growing data set.
Is there a way in which MS Excel 2010 recognizes a dynamically sized data set from Bloomberg and automatically propagates referring formulas in adjacent columns downward (without using VBA)?
I can think of two possible ways that you could approach this. First, you could write your formula in a way that won't return anything if there is no date from the Bloomberg call in that row. For example, in your example your formula could be
=IF(A3="","",B3*C3)
You could then paste this down much further than your data will go. Even if the B3*C3 piece of the formula is costly, I don't believe it will slow your sheet down much as excel shouldn't even try to evaluate that piece of the formula unless there is a date in that row.
The other option would be to use VBA. You can take a look here for a relatively simple example.