Replace value in the same column based on ID number EXCEL - excel

Does anyone have an idea how to solve this problem using Excel? I have this table. As you can see there is false information in the data, as the "Customer_since" column has different values for the same customer (column "cust_id"). "Customer since" column defines the year of the customer's first purchase. Here is the table:
In fact, the year of the first purchase must be the same in all rows for the same client. In my solution, I would like to keep the earliest year (of the first purchase) for all clients. As you can see one client can appear in many rows, for example, client 275250 had 8 purchases (means 8 rows in a data set) and client 275246 had only 4 purchases. I cannot change it manually as the data set contains over 7000 rows. The desired solution would be to get the same year of their first purchase for the same customer in all rows (for example, correct data is for 275252 and 275233 customers).

MINIFS will get you there. https://support.microsoft.com/en-us/office/minifs-function-6ca1ddaa-079b-4e74-80cc-72eef32e6599
Below, I'm using formula =MINIFS(C:C,B:B,B2) where C:C would be the range of your transaction dates, B:B is the range of customer IDs, and B2 is the current customer ID.

I would do the following:
Create a new table with unique cust_id and the corresponding min(Customer_since). A PivotTable would do it easily.
Change the column Customer_since to use XLOOKUP() to find the correct value on the new table.
If needed, you can do it on another worksheet and Paste Values back into this.

Related

Populate a blank column with another column using two other columns on two separate tabs

I have one spreadsheet with two tabs. MTD Revenue contains a column for District and a column for Contract #. MTD Costs has a column for contract # and I've added a column for district. Is there a formula I could use where the blank district column is auto populated using the contract # and district columns from the MTD Revenue tab. The link to the two tabs would be the contract #.MTD Revenue TabMTD Costs Tab
In all of the other formulas I've seen on here the user specifies what the output should be. I want what is actually in the district column to come over to the MTD Costs tab. For instance, in the screen shots, ST-544B49-01 is found on both tabs. On the MTD Revenue, ST-544B49-01 has Amite in the District Column. I want that record to come over to the MTD Cost tab under District.
My first thought was to use a vlookup in the empty column=VLOOKUP(B2,'MTD Revenue'!A:K,1,FALSE) This gives a value is not available to the formula or function error.
My second thought was to use index and match in the empty column=INDEX('MTD Revenue'!A2:A503,MATCH('MTD Costs'!B2,'MTD Revenue'!F2:F503)). This only populates some of the cells and give a value is not available to the formula or function error.
I'm not the greatest formula writer so I think I'm close but am writing the formula wrong or I'm missing a piece.
I can provide the data if needed.
I was able to get this to work using the formula below
=INDEX('MTD Revenue'!A:A,MATCH('MTD Costs'!B2,'MTD Revenue'!F:F))

Create calculated column in one table using data from another table in Spotfire?

Apologies for asking this, I see a few similar questions but unfortunately I don't really understand the answers given. I am fairly new to Spotfire.
I am trying to create a calculated column in one table based off of data from another table. The first table (which I am trying to add the new column to) is a monthly data census of all contracts the company has. Each contract has one row. Call it "monthly table". The second table is a complete transaction history for all contracts, so each contract can have hundreds of rows. Call it "total table".
I am not sure if I can link the data tables. I read in a few similar questions to insert columns from the table with data into the table where the new column will go, or to merge them beforehand, but the monthly table has about 13,000 rows compared to the total table's 550,000, so I am not sure how this would work.
I am trying to create a column to sum all the transaction amounts for each contract if the transaction type (also in the total table) is equal to a certain string. Like a "net transactions to date" column. I successfully created this column in the total table, but then each cell for a contract that meets the conditions had the transaction sum. I want it in the monthly table, where each contract just has one row, and it only displays the sum once. This is the code I have:
IF(
Concatenate([Contract_Number],"(transaction type string)",[Month],Year([Date]))
=[Type],
Sum([Amount]),
NULL)
It is currently in the total table. If possible I would like it in the monthly table, and for the [Number] and [Date] columns to refer to the monthly table, and [Type] and [Amount] to the total table.
Sorry if this is too much information or confusing! Also I know there is a problem with my summation (it is summing all transactions and only displaying in the correct rows, but it needs to only sum correct rows), but I think I can figure that one out, I just need help getting it in the right table.
I am currently working on transitioning a process/workbook from Excel to Spotfire.
If it would help I can provide the current formula used for this process in Excel.
After a few more hours of tinkering, I figured it out! I thought I would explain what I did here in case anyone else encounters a similar conundrum.
TLDR; Made the desired column in the total table, and added the new column to the monthly table with a left single join on the contract number.
My month and date are tied to a document property which is a drop-down of unique date values in my monthly table. Within the total table, I used a similar code to what I've typed above, but instead of referencing the Date column directly, I referenced the document property, so it was pulling the date from the monthly table into the total table. I also switched from the form IF(condition, SUM()) to SUM(IF()) OVER (). This ultimately summed the correct values. For example, there might be five different types of transactions for each contract, but I only wanted the sum of two types. This resulted in the correct sum being displayed. The sum was displayed in every single cell corresponding to the correct contract number in the new column, so (in the same example) in all 5 contract #1 rows, the sum of the two correct types was displayed.
Then, I went to the data canvas for my monthly table, and added the new column. I chose a left single join, as each contract had only one row in the new table, so that the correct sum would only be displayed once.
End result code:
SUM(IF(Concatenate([Contract_Number],"type-string",[Month_ValDt],[Year_ValDt]) =
[Type], [Amount],0)) OVER ([Contract_Number])
Where [Month_ValDt] and [Year_ValDt] are new columns I made in the total table that display the month and ye
ar from the document property that is tied to the date in the monthly table.
Reasoning for the property is that we have a few years of data but I was told to make it dynamic so only one month of data is visible at a time, hence the drop-down.

excel - advanced vlookup or other formula?

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.

Find all matching categories, there equivalent value, and only grab the values for that month? Images attached to help understand

I am trying to create a budgeting spreadsheet, I nearly have it all working except one function.
Monthly Budget Sheet: http://i.imgur.com/uLJ1AfA.jpg
In this I am trying to read all data on my Transactions Sheet column B: http://i.imgur.com/0SaWEqa.jpg
if they match the Category I have in Monthly Budget B column, I grab the value from Monthly Budget column C and add them up in Transactions column D.
This is my current function: =sumif(Transactions!B:B,A4,Transactions!C:C)
Hopefully my pictures explain what I am talking about. My issue is I also want to filter it so it only adds the values of the ones for that month. E.g. the column 'Actual' in Monthly Budget should grab the value of Eating Out categories in Transactions ONLY IF they are in January, so the first 2 in the image but not the third.
So basically I need to add some way to modify =sumif(Transactions!B:B,A4,Transactions!C:C) so that it will only take entries between 01/01/2014 and 31/01/2014.
Thanks in advance!
use the Month() formula
i think it would be alot easier if you add another column(B) on the transaction sheet after date called month( hide it if you like)
=CONCATENATE(MONTH(A2),"-",YEAR(A2))
then use the SUMIFS function to add up based on 2 criteria
=SUMIFS(Transactions!D:D,Transactions!C:C, A4 ,Transactions!B:B, "1-2015")

Excel function advanced filter

I have a list of sales people and a list of their sale revenues in two separate columns. How do I use an advanced filter or other sorting means to find the max of the sale revenue column and then have the formula output be the corresponding sales person?
Referencing this page:
http://www.techonthenet.com/excel/formulas/max.php
In this example, assuming column A was your list of salespeople and column B was your list of sales revenues...
=Max(B2:B6)
in any empty cell would return the highest sales revenue from column B.
I figured it out.
You first need to set a criteria. In the link's example, you would first (off to the side) make a small column that had a title of Value, then right under that put in the function =Max(B2:B6). Then click the "Advanced Filter" button. The data range would be the entire database, A1:B6. The criteria range is the new two row column you just made of Value and the Max formula. Then select and output range that will be big enough to hold your filtered data. in this case, a 2x2 grid will be enough. (Make sure to click the copy to new cell option at the top.)
The resulting filter will be the Date of the Max Value.
This is my first answer post on this site, so please let me know if I formatted it wrong.

Resources