Excel duplicate date subtraction - excel

I have a table in Excel, with names in Column A, and dates in Column B. Names are present several times for the most part, each carrying a payment date in Column B. So if someone received one payment, the name is there once, with a date. If someone received eight, the name is there eight times, with eight different dates.
What I'm looking for is a method, to take each name (not the occurrence, but the same string), and present the difference of the maximum and the minimum date for every string that is the same (i.e. the date range of payments for every single person).
I tried basically everything in Excel. Conditional formatting and Pivot Tables did not help (the latter can only add, not subtract when using PT). Manual work would take a lot of time even if specifying min and max values for the entries, since the table has 17033 rows with 2218 unique names.
I would be grateful if you could help. I suspect the solution is not that hard, but I cannot really get my head around it.

You can use a standard array formula to list the distinct names e.g. in D2:-
=INDEX($A$2:$A$10000,MATCH(1,(COUNTIF($A$1:$D1,$A$2:$A$10000)=0)*($A$2:$A$10000<>""),0))
Then another one to find the maximum for each name and subtract the minimum:-
=MAX(IF($A$2:B$10000=$D2,$B$2:$B$10000))-MIN(IF($A$2:A$10000=$D2,$B$2:$B$10000))
But these are slow with ~10000 rows - a pivot table is much faster.
I would keep things really simple by putting the minimum and maximum date as value fields in the pivot table and manually adding a formula to subtract one from the other - will post a screenshot later.

Related

Make excel filter and actualize automatically

I have two sheets, one with a dashboard and another one with the data I need.
In data sheet: So many lines, that I filter by date. I need to know in Weeks, every record that contains in that, for example: I need to know how many records do I have in Week 43 (18-24 OCT). For that, I manually apply a filter and I count the number of records.
In dashboard sheet: I show the number of registers I got in the datasheet.
I want to automatize all this process, I want to do a formula in the dashboard sheet that can filter and show automatically the number of records I got in week X, excluding some variables I have in another column. The column I need contains letters and numbers, random (I need to sum these records, separated by date in weeks). All that I don't need to filter, what I need to exclude from my search starts with AWBXXX (random numbers too).
Example here:
What I need to filter, in green. What I don't need, red.
Please, help! :D

Argument to find data in large Excel document to later use with other data found

I have a very large Excel document with something like 7500 rows. Not all of the data is needed, but I want to use some of the data to find how long an order takes from start to end (lead time).
I tried starting with the INDEX function to find and out put individual order numbers based on another cells data ("Order has Shipped"). This formula worked, however it only returns the very first Order Number and no others.
My thought here was that I could do one column that pulled all the order numbers based on the "Order has Shipped" requirement. After that, I would do a similar function to give a second column next to the order numbers that showed the correct data and time stamps. After that, I would do two more columns with basically the same information, but to show when the order was first entered and spit out another time stamp. From these two time stamps, I could do a simple function to calculate the difference in time.
I wanted to put these into new columns so I could also find the average lead time, number of orders shipped, and other things.
=INDEX(D:D,MATCH(L11,G:G,0))
Any help would be greatly appreciated.
Try using =IF(L1="Order has Shipped",D1,"") to get the Order Numbers and then you can "Find & Select" and click "Go to Special", then click blanks. This will select all the blank values. Then click delete and it will get rid of all the spaces in the rows so you have all the unique order numbers that have been shipped listed in one column.

Combining Non-Zero Values from Multiple Columns into One in Excel

Every month I get given a budget from one of our clients in a Google sheet, which I need to convert into a SQL query so it can be uploaded into our database. As the number of rows and columns changes, I want to write some formula to semi-automate the process for time saving and mistake elimination.
This budget has spends in multiple columns, which I've managed to write formulas to combine into one column, with the correct details in the columns next to it (see example links below).
How I've transformed the data so far
The issue is this budget per country and partner, then has to be split again across multiple options. This leaves me with three columns worth of spend values, that I'd really like to combine back into one column, and ideally skip out all the zero values.
I've found an array formula on this site that will skip the zeroes, but I can't get it to work on more than one column.
=IFERROR(INDEX($U:$U,SMALL(ROW(myRange)*(myRange<>0),SUMPRODUCT(N(myRange=0))+ROWS($1:1))),"")
From this Question's Answer
Is it possible to write a formula, that skips the zero values down one column, and then starts at the next? And that will also allow me to keep the correct matching details from the other columns alongside it, as well as bring in the column headers for the options as entries in a new column?
Thanks
Edit:
Here is the final format I'm looking for:
There is a concatenated field off the end that combines all the columns. Most of the values are populated by various Vlookups, to transform from the text version, into the database IDs, needed to fill the table.
It's also worth saying, that not being able to skip the zeros, is OK, as I can manually delete them fairly easily.
But as the number of countries and partners can and will change, I want the formula to be able to move column at the end of the dataset.

Excel formula for finding average value in a discountinue serie of dates

I am extracting data from an account statement which you can see simplified in the image in the columns A:B in red:
On A the date (in order ascending but not necessarily incremental by one) and often duplicated due to multiple account entries) and on B the fund value.
If there are days missing, the fund value is the one of the last displayed day
=> I need to for each row on C, the average of fund since the first entry of the series (January 1st).
I can do it easily if I bring to a sequential order the fund values as I did in columns G:H but I would like to avoid this method and find a formula that placed in columnC gives me the average value. Possibly no VBA
Thanks
----ADDED---
the result I would like to see and the file example
http://www.filedropper.com/example_29
How about the following formula:
=(IF(DAY(A3)-DAY(A2)>=1,(C2*DAY(A2)+B3+((DAY(A3)-DAY(A2)-1)*B2))/DAY(A3),C2))
Note that the dates need to be in subsequent order and field C2 needs to be hard-coded for my solution to work.

Countif with dynamic headers

Good afternoon! I'm trying to get a Countifs or Index Match statement to count the number of times a value occurs in another table. The example:
On my report sheet, Column A contains 10 different statuses, such as Green, Yellow, Red etc.; Row 1 contains six dates, such as 1/31/2015, 2/28/2015, etc. These dates are calculations. The last date references my date worksheet and the five other use EOMONTH to get the month end for the five prior months.
On my data table, I have 7 descriptive columns (such as Type, Make, Model, etc) and then we begin date columns: 1/31/2010 all the way to 7/31/2015. I add a new column each month (I know, I don't like it either, but unfortunately we don't have a time series database).
What I need to do is have a Countifs or Index Match that pulls the date from my report tab, goes and finds it in the header row of my tblTrends, and then counts all those statuses that are Green, and if it's a SUV (for example).
Thoughts?
Thx!!
G
At it's most basic, you'd want something akin to:
=COUNTIFS(TypeRange,"SUV",FirstMonth,Status)
So let's say your data table starts in column L, and the first date column is O:
=COUNTIFS($L$1:$L$100,"SUV",O$1:O$100,A$2)
As you drag this formula across the different dates, it will move the date reference over one to the next month.
If you need it to dynamically determine the date column, I'd recommend OFFSET, which dynamically select a range. However, note that OFFSET is a "volatile" formula, which means it re-calculates anytime a change is made anywhere in the file, which can lead to pretty slow load times if not used sparingly.
=COUNTIFS($L$2:$L$100,"SUV",OFFSET($N$2:$N$100,,MATCH(B$1,$O$1:$Z$1,0)),$A2)
The OFFSET starts on column N, because that's the first column before the columns we want (the date columns). The MATCH tells it how many columns to OFFSET from here.
If you're going to use this over a large amount of data, then you could avoid using the OFFSET formula by creating a dynamic table. This table would only contain data for the six months you're interested in, by utilizing INDEX/MATCH, and you could run your COUNTIFS off this table, instead, using the original, basic method I first described. I can go into detail if you're unsure what I mean.

Resources