I want to track the expenses of me and my friends with excel. I have the following table structure:
Date
Amount
Paid By
Split Type
Name 1
Name 2
Name 3
...
16.05.
4.99$
Name 1
Split Equal
...
16.05.
10$
Name 1
Split Unequal by Percentage
50%
50%
...
18.05.
10$
Name 3
Split Unequal by Amount
2$
6$
2$
...
The goal is, to create a matrix-like table where you can easily read which person owes another. By using a simple excel table with big, nested formulas & try and error I was able to successfully accomplish this. However, I'm curious whether this would be doable using Pivot Tables, since they are very powerful and I always feel like "they can do everything" (and the formulas are neither nice nor easy to maintain in the future).
So for the above example, the desired result could look like this (I guess the way you get there should be pretty obvious):
Name 1
Name 2
Name 3
Name 1
-
-
0.34$
Name 2
6.66$
-
6$
Name 3
-
-
-
Question
So in short, my question is: Is there a way of creating the second table based on the first one (and maybe additional "helper" tables) using Excel's Pivot funcitonality? I would be really happy to get answers / tips for this. It would also be sufficient if you show me one case (i.e., split unequal by amount) and I'll implement the other cases based on that.
What I've tried so far
As already stated above, using a plain table I was already able to solve this task. However, the solution doesn't seem to be very elegant and thus I tried to accomplish it with by using a Pivot Table. I created one but I already struggle to get the same names in the rows & columns. If I get this working somehow, the next step would be to compute the correct values in the cells (I assume by introducing a new measure and a DAX-Formula, but I have no idea how :D)
Thanks for your help and feel free if you need more information!
Edit 1: Clarify the Result Matrix
As Jos stated, the result matrix maybe isn't that obvious unlike I throught, so I'd like to give one example:
Name 1 owes Name 3 0.34$ - why?
Name 1 pays 4.99$ and this should be split equally (thus in particular name 3 owes name 1 1.66$.
Name 1 pays 10$, however this doesn't account to name 3 since only name 1 and name 2 have to share this money
Name 3 pays 10$ from which name 1 ones him 2$, name 2 6$ and name 3 2$.
In sum, name 3 owes name 1 1.33$ from the first payment, and name 1 owes name 3 2$ from the third payment. This can be summarized by: name 3 owes name 1 1.66 $ - 2$ = -0.33$ (which is the same as saying name 1 owes name 3 0.33$
Related
I have 50 states to assign to three sales directors.
Using Excel I have tried, and failed to use nested IF formulas.
When a new sales lead is added, I want the appropriate sales director for the state to be assigned. For example, lead in NJ gets assigned to director X, lead in CO gets assigned to director Y.
I have the states broken down on the spreadsheet in their own columns.
Ex W3-W20 for Sales Director X, but I can't get the formula to work. I keep getting a #Value! error.
Here is what I have tried:
Attempt 1
=IF(B844=(W3:W20),"Rosado",IF(B844=(X3:X24),"Votaw","Snorty"))
Attempt 2
=IF(B844=W3:W20,"Rosado",IF(B844=X3:X24,"Votaw","Snorty"))
Attempt 3
=IF(B844="W3:W20","Rosado",IF(B844="X3:X24","Votaw","Snorty"))
Attempt 4
=IF(B844=(NJ,CT,NY,VT,DC,VA,MD,ME)"Rosado",IF(B844=CO,MT,CA,NV,AZ,OK,KS,UT,TX)"Votaw","Snorty"))
I've tried about 10 other versions of the above but can't get anything that works.
I expect that when a state is entered in one field (ex:J844) that the correct sales director assigned to that state auto-populates in another field(ex:L844)
One way, In a separate sheet (ideally) you have a lookup table of states, say in column A, and the Director's Name associated with each state in Column B.
Personally I'd create a named range for this table and then the equation in L844, per your example, is a simple VLOOKUP(J844, TheNamedRange, 2, FALSE) where TheNamedRange could be defined as, for example, Sheet2!A1:B50 or whatever your needs may be.
So, shown both methods here, index with match for the director and vlookup for the abbreviation:
I would have the table of data (cells A1 to C8 for me but larger for you) on a separate sheet (or even a separate workbook) - the functions will still get the results...
Part 1:
Cross Reference Column A Sheet 1 to find a matching value on Column A Sheet 2, and then fill in corresponding Column B, C, D Values from Sheet 2 for Sheet 1.
I have 2 sheets:
Sheet 1: Company & Representative
Sheet 2: Company & Client first name, Client Last Name, Client Email
I want to match to put in new columns on Sheet 1 that have the client first name, last name, and email based on the company matching ( they do not match by cell #).
Does anyone have any advice on how to do this? I've got about 2000 and know there must be a better way than manual.
Part 2:
Is it possible to use a similar formula to populate paragraph text in another column if the company name contains certain text or letters? Say the company titles are various and long but each contains adjectives that can help distinguish their industry or years of experience, then is it possible to make another column including 10+ possible conditions to fill out different paragraphs depending on the conditions met?
So for example have company names in column A drive company industry supply list (that will be in paragraph form) in column J. Here is an example:
Column:
ABC level 1
ABC level 2
ABC Levels Elementary
ABC Levels Advanced
BCD Level 4
BCD Level All
BCD Level Intermediate
(continued until infinity..)
XYZ Company Level 12
If Level 1-6 or Elementary: Input >
Eucalyptus is one of three similar genera that are commonly referred to as "eucalypts",
If level Intermediate: Input>
Tree sizes follow the convention of:
If Level Advanced: Input >
A mature eucalyptus may take the form of a low shrub or a very large tree. The species can be divided into three main habits and four size categories.
If level all: Input >
Eucalyptus is one of three similar genera that are commonly referred to as "eucalypts"
+
Tree sizes follow the convention of:
+
A mature eucalyptus may take the form of a low shrub or a very large tree. The species can be divided into three main habits and four size categories.
eucalyptus copy used for example only and to educate us all on the eucalyptus plant of course. ** changed the copy to shorter so we can more easily read the example**
enter image description here
Thanks so much!
Kalina
Say if I have a Sheet2 with data like the picture showing below:
My Sheet1 should look like this:
There are at least two ways to accomplish your goal:
VLOOKUP (show in column C, Matching 1):
=VLOOKUP(A2,Sheet2!$A$2:$D$8,2,0)&", "&VLOOKUP(A2,Sheet2!$A$2:$D$8,3,0)&", "&VLOOKUP(A2,Sheet2!$A$2:$D$8,4,0)
The VLOOKUP just repeated three times to concatenate the first name, last name and the email.
INDEX/MATCH (show in column D, Matching 2):
=INDEX(Sheet2!$A$1:$D$8,MATCH(A2,Sheet2!$A$1:$A$8,0),2)&", "&INDEX(Sheet2!$A$1:$D$8,MATCH(A2,Sheet2!$A$1:$A$8,0),3)&", "&INDEX(Sheet2!$A$1:$D$8,MATCH(A2,Sheet2!$A$1:$A$8,0),4)
Similar to VLOOKUP to repeat three times.
Hope this helps and let me know if you have any question.
Here is how you can do for your part 2:
For example you have setup a table to show different levels and descriptions (Column D and E). And you want to find the description under column B from the given company info on column A. Here is the formula you want to enter in cell B2 and copy/drag down.
=IFERROR(VLOOKUP(RIGHT(A2,LEN(A2)-FIND("Level",A2)+1),$D$2:$E$11,2,0),"Please verify company name")
What this does is first, use RIGHT(A2,LEN(A2)-FIND("Level",A2)+1) to find which level keyword inside the company name. Then use VLOOKUP to look the matching level and grab the description from column E. I also added an IFERROR just in case someone entered an incorrect name. You can change that message output to anything you like. Hope this will solve your problem and let me know if you have any question.
I would suggest putting data info on each tab into a tables, and then using an Index-Match or a vlookup to pull the data from the other table that matches. It's hard to give an exact answer without an image/example.
Not sure if this can be done through Access or some simple code in Excel? But say I have in Excel a few rows like so:
CARD TRIGGER CATEGORY QUANTITY TARGET
Magma Drake StartOfTurn Damage 1 Opponent
Lava Moat ReciveDamage Damage 5 AttackingCards
Rockslide AfterCasting Damage 15 AllOpponentCards
Ash Imp AfterCasting Damage 5 TargetOpponentCard
Eruption AfterCasting Damage 15 TargetOpponentCard
Eruption AfterCasting Damage 15 Opponent
Lava Streams StartOfTurn Mana 2 OwnerMana
Firebomb Troll Death Damage 8 AllOpponentCards
Scorched Avata AfterCasting Damage 8 Opponent
Scorched Avata AfterCasting Damage 8 Owner
Hero of Flame AfterCasting Stats 3 AllOwnersCards
Falling Stars AfterCasting DamagePlus 8 Opponent
Falling Stars AfterCasting DamagePlusPercent 4 AllOpponentCards
I want to be able to export this to Access, but instead of strings for the TRIGGER, CATEGORY and TARGET, I want to use numbers. Thus:
StartOfTurn = 1
ReciveDamage = 2
AfterCasting = 3
Death = 4
ect... for all 3 columns. I was not sure if I could put in an alias value for strings and then export the alias value? How can I do this? Also note I would like to keep the string values in Excel as its easier for me to understand, but its easier for code if the values in Access are numbers.
One approach might be:
Create "lookup" tables (say, named Triggers, Cateogories, and Targets) in Access that list the numbers that correspond to the strings.
Import or link your existing Excel data into a "staging" table in Access.
Write a query in Access that joins the staging table to the lookup tables to "look up" the numbers based on the strings.
Use the query directly, or run a make table query or an append query based on it to transfer the results to a separate table and use that table instead.
The easiest thing would be to export the whole table into Access and then run an Update query in Access to replace the values you want replaced. So far as I know, you can't update values only on export, you would have to first replace them in Excel which you said you don't want to do.
Also, for the record, it would be very easy to keep this all in Access if you used dropdowns (aka Combo boxes) to choose your values. You could display the full string, but only store the number in the table.
Not sure i used the best approach, but i created a lookup table like Brian said, but in excel. So i had something like
B1 B2
triggers triggers_numbers
startofturn 1
endofturn 5
endofturn 5
Afterattack 4
startofturn 1
Then when i imported the data to access, i used the values in trigger_numbers instead of triggers.
I have searched every where, but I cannot find an answer to this.
I have a sheet containing information regarding different pipes running under a railway. There are different owners of these pipes (18 to be exact) through out the length of the railway.
Here is an example
ID TYPE INFO1 INFO2 OWNER
1 A GAS STAYS GC
2 A TELE GOES TC
3 B GAS GOES GC
4 A POW STAYS EC
...
and so on so forth for 500 pipes.
If I then use a filter option to only show all pipes from one owner, I would like the owners contact information to be inserted in cells B3:F6. I have the contact information in another sheet.
Is this possible? If yes, then how do I do it?
Try putting in a helper column with a formula like this:
=SUBTOTAL(3,A2)
[Assuming column A is a column that will be populated for every row]
That will show a 1 in visible rows, so you can get the first visible owner with a formula like
=INDEX(Owner,MATCH(1,Filter,0))
....and you can use that in lookup/index formulas to retrieve contact info for that owner
Is it possible to parse/cast text (like "=A1+A2") as a formula in MS Excel? I want to build a formula from pieces of text - some of which will only be typed in later by a user.
If the INDIRECT() function did not only work for referencing cells, then I could have typed this =INDIRECT("=A1+A2").
I know you can a work around this problem by simply adding a lot more hidden columns to do sub calculations. But for the sake scalability and efficiency, I would rather do something like the above.
I found a similar questions here and here, yet they don't solve my problem.
The Real-world problem:
Read on for a better understanding as to why you would want to do the above
Scenario
Each item in the list consists of a string, which contains anywhere from 1 to 5 account names each. Each account name is followed by an account number in brackets. The length of the number determines the type of account. Part of the account number is a date, of which the date format depends on the type of account. Further more, each account type may have more that 1 account-number length associated with it, although each number-length[*] is only associated with 1 account type.
Objectives
Extract account-names and their respective account-numbers and account-types from a list.
Make an assumption as to the account-type from the account-number
Validate this assumption by inspecting the build of the number and elements in the name
Check the validity of the account-numbers depending on their type.
The tricky part (this is where my problem lies)
The account-types and their respective account-number-lengths are not known before hand, and are typed into a table by the user of the sheet, specifying a type of account and the number-lengths associated with this account-type. The user should type this into a list - not go and tinker around with delicate formulas
Done so far
Column A: Contains the raw data (each cell has up to 5 names and numbers)
Columns B..F: Each column extracts 1 name, remains empty if all are already extracted
Columns G..K: Each column extracts 1 number corresponding to its name in columns B..F, remains empty if all are already extracted
Columns L..P: Each column calculates the length of the corresponding number in columns
G..K
Now the user would type the following details into a table which assigns certain number-lengths an account type:
TYPE2, BUSINESS, (OR(length=13,length=6))
where length will later be replaced with the cell address which contains the calculated account number-length.
What I want to do now
Columns Q..U:
Should all indicate the account-type of the corresponding account-number in columns G..K. The idea is to build a nested if-elseIf-elseIf formula using the criteria typed in by the user as specified above. Example of one of the elseIF statements:
SUBSTITUTE(CONCATENATE("=IF(",criteria,",",type,",",errCode)),"length","O10"))
All of these elseIf statements will then be concatenated together to form a master formula which will then need to be parsed/cast as a formula to calculate the account-type
This proposal uses only 5 columns (1 for each account-number, containing the master formula) and a table specifying account-types and criteria, also keeping the user away from formulas. Editing 1 line of code (the criteria) will update all formulas. Efficient & Scalable.
Since the user should never tinker around with the formulas under the hood, a simple 1 column if-elseIf-elseIf is out of the question. The alternative to the above would be to make a separate column to test for each account-type for each account-number. Separating/Abstracting out each test to its own column results in much better readability, easier editing & much less debugging - Unless you like multi-screen-wide-formulas. Example: 5 account-numbers * 10 possible account types = 50 extra columns.
Each edit to any criteria needs to copied to 4 other non-adjacent columns and drag-filled down 10,000 rows (columns can not be adjacent since it is effectively a 5x5 array of columns). Not Efficient nor scalable. Unless I'm missing some elegant way of updating non-adjacent formulas in a single click
The rest of the validations error indications are trivial.
Sample data
Tshepo Trust (6901/2005) Marlene Mead (8602250646085)
Great Force Inv 67 Pty Ltd (200602258007)
Jane (870811) Livingstone (6901/2005) Janette Appel (8503250647056) James (900111)
I know all this would probably be much easier to achieve with clever usage of VBA, eliminating all the need to simulate abstraction, encapsulation, multi-dimensional arrays and functional programming on a spreadsheet. But until I can program in VBA, worksheet formulas will be my refuge.
[*]: account number-length could also be described as the amount of digits in the number or as indicated by this formula: LEN(accNumber)
In VBA you have access to Cell.Formula.
I usually used Range to peek a cell by address.
I'm not sure if this would answer your question(it's a very detailed question!), but if your user was entering the account numbers in a table (I'm calling it 'RefTable') , that was:
Length of account number | business type
----------------------------------------
6 | Accountant
8 | Advisor
Then you could just use a vlookup on the length of the account number, given you've already separated them out.
=vlookup(len(accNumber), Reftable, 2, false)
Make sure that you either use a dynamic range name, or specify plenty of space below in RefTable, so that when your users add types, they don't get lost.
Also, if you have two different accounts with the same length, this could get you into trouble.