This question already has answers here:
Formula to generate a value according to a range
(2 answers)
Closed 4 years ago.
[enter image description here][1]I haven't used Excel since high school (2004-2005) but I was pretty proficient in writing formulas back then based on static and dynamic cell values. I'm currently trying to make a spreadsheet that can keep up with statistical data based on yes and no inputs (or 1 and 0 if you prefer binary).
In a game, I am managing a business and want to be able to keep track of employees based on their success. Success is a yes/no value. I'd like to have a table on sheet 2 that has the entire success/failure history of the player and on sheet 1 have a brief overview of their history that's listed on sheet 2 (overall success rate, success rate of last 10 inputs, and success rate of last 5 inputs).
I may or may not be able to figure out the formulas for those. If not, I'll be sure to research before asking for help on that. What I can't figure out is how to assign a word value for a given success rate. For example, I'd like J7 to give a value of "Trusted", "Dependable", "Endorsed", or "Warning" based on the value in K7. If the value of K7 is 90%-100% J7 should populated "Trusted". If the value of K7 is 80%-89% J7 should populate "Dependable". If the value of K7 is 70%-79% J7 should populate "Endorsed". If lower than 70% J7 should populate "Warning".
I'm trying to make the spreadsheet easy to use so that when I expand in the game I am able to share the spreadsheet with new branch owners to keep track of players working under them. That's why I would like the spreadsheet to be easy to manage so it doesn't take them long to figure it out and it doesn't take a long time to manage the spreadsheet so it doesn't rob them of game time.
Thanks in advance :)
This can be done using the lookup function as noted by Jeeped or simply using the IF function. Try using the following in you J column next to the first row of data and populate all the way to where the row where your data in K column goes:
= IF(K1<0.7, "Warning", IF(
AND(K1>=0.7, K1<0.8), "Endorsed", IF(
AND(K1>=0.8, K1<0.9), "Dependable", "Trusted")))
Try this in K7,
=LOOKUP(J7, {0,0.7,0.8,0.9}, {"Warning","Endorsed","Dependable","Trusted"})
Related
I am currently trying to create an if statement that sums values based on whether a date has passed.
Excel example image
M1 to M12 dictate the months of the year e.g. 01/01/2021 for M1 and 01/12/2021 for M12
Now I want to create or use a formula that sums the values in row 4 based on what month we are currently in --> If we are currently in M1, e.g. 15/01/2021, then it only needs to sum the value in A4. However, if we are, for example, in M3 (28/03/2021) then it needs to sum A4 + B4 + C4
I tried using the following formula but the problem is that when it finds a value larger than 01/01/2021 it doesn't take other months into consideration anymore
=IF(TODAY()>=A2;A4;IF(TODAY()>=B2;SUM(A4:B4);0))
I added the zero at the end of the function to close the formula but my idea was to prolong it up til 12 months. However, it only ever sums the first cell (A4) because conditions have already been met. How do I 'overwrite' the first condition if more months have passed?
Any help would be greatly appreciated; I excuse myself for asking potentially dumb questions but Excel isn't my strong point and I am trying to learn.
Kind regards,
VHes
Try:
=SUM(INDEX(4:4,SEQUENCE(MONTH(TODAY()))))
An alternative approach using SUMIF:
=SUMIF(A2:L2,"<"&EOMONTH(TODAY(),0),A4:L4)
If SEQUENCE is not supported by your version of excel, (based on comments it does), you could also try the following:
=SUM(A4:INDEX(A4:L4,MONTH(TODAY())))
The trick here is that INDEX actually supplies a cell address, and displays the contents of that cell when needed.
I have a cell where I want to get the tax% based on a criteria
Coming from "Taxes", depends on manufacturer country, year of release and car type
I've tried to use search and index and its not working at all, I need the cell to check values in the manufacturer country, year of release and car type use these inputs go to the Taxes sheet and get the value
Before I start, I should come clean and say I am an evangelist for the OFFSET() function, and a mortal foe of INDIRECT().
Let's assume that the number of vehicle types (TRUCKS, SEDANS, ....) is the same for each country, ie 8. (If its not then that can be worked around with a bit more effort). You could put this number in a cell somewhere and use it when you need the number of types.
Also, let's say the first column in your screenshot is column A. And that the cell A1 contains "China".
Let's say we are looking for the tax rate in 2009, for SEDANS in France.
Function 1:
=MATCH("France",$A:$A,0) will return 14 (if I have counted correctly)
... ie cell A14 contains the word "France".
On the assumption that the years are the same for all countries we can use any of the header rows to find the right column.
Function 2:
=MATCH(2009,$3:$3,0)-1 will return 8 I think.
If your years are just strings of text, then replace 2009 with "2009".
Because your Types are not in the same order in each table (why?) we need an extra step.
Function 3:
=MATCH("SEDANS",OFFSET($A$1,(Result of f1) -1 + 3,0,8,1),0) should return 3.
What is the maths in the OFFSET function? I need to go down (14-1) rows from cell A1 to get to "France". From there I need to go down another 3 rows to get to the first of the list of Types, and there are 8 types to search in. I'm then looking at a range of cells which is 8 rows x 1 column.
Now you can extract your tax rate, using
Function 4:
=INDEX(OFFSET($A$1,(Result of f1) -1+3,1,8,100),(Result of f3),(Result of f2))
(I've put 100 as I don't know how many columns of years you have. You could use something like =COUNTA($3:$3)-1 if there was nothing else in the 3rd row after the last date).
I would put the results of each function in a cell while you test this. Once you are happy that each step is working correctly you can nest all the various functions together, or alternatively just put some extra columns on the right hand side of your results table, which you can Hide if you want to.
EDITED: To add some $ on cell references to lock the "origin" of the data.
If your tax tables are real Tables, each NAME'd with the name of the respective country, you can use something like:
=VLOOKUP(H13,INDIRECT(H12),MATCH(TEXT(H14,"0"),INDIRECT(H12 & "[#Headers]"),0))
where
H12 contains the name of the country
H13 contains the Type of vehicle
H14 contains the Year
eg:
You'll need to adapt this to your real ranges, but this provides an approach.
I'd suggest using dropdown lists (from Data Validation) in H13:H14 in order to avoid typos.
If you want to avoid using Tables and also the volatile functions OFFSET and INDIRECT (because if you have a lot of volatile functions they can impair performance of your worksheet) you can try the non-volatile, but longer and more obscure:
=VLOOKUP($H$13,INDEX($A:$A,MATCH($H$12,$A:$A,0)):INDEX($D:$D,LOOKUP(2,1/($A:$A<>""),ROW($A:$A))),$H$14-2000,FALSE)
In the above, you'll have to make adjustments
Assumptions are:
The country name is above the relevant tax table
Tax table starts in Column A
Change references to Column A if it does not start there.
Change the reference to Column D to the last column of your tax table (or even further if you will be expanding it).
The Year columns are labelled the same for all countries (eg: consecutive years starting at 2002)
$H$14-2000 calculates the column argument for the VLOOKUP function.
I'm practising MS Excel skills. I have a workbook in which I want to analyses data from different tables.
Each worksheet contains a table with the information from the year. So in worksheet "2017" I have a table named "Table2017". I have this for each year (starting 2015).
After a some research, I finally found a way to count how many times something in a certain place happened.
=SUM(COUNTIFS(Table2018[Place];B3;Table2018[Activity];{"Paid";"Awarded"}))
+SUM(COUNTIFS(Table2017[Place];B3;Table2017[Activity];{"Paid";"Awarded"}))
+SUM(COUNTIFS(Table2016[Place];B3;Table2016[Activity];{"Paid";"Awarded"}))
+SUM(COUNTIFS(Table2015[Place];B3;Table2015[Activity];{"Paid";"Awarded"}))
This works perfectly. It will calculate how many times per place a paid service or an awarded (gifted/sponsored) service was delivered. In the B column, I have a list of places (hence the B3 reference), so after completing the formula, I can select the cell and enlarge/drag to copy it to the rest of the column and apply for every place.
However, the formula is really long and every year upon creating a new worksheet, I need to add a new part to the formula.
Is there a way to compact this? And ideally have the formula search for every table that has the relevant information (like: "Table20??" or "Table 20*"), go in and count the times my conditions are found?
I hope my question is clear enough.
Thanks in advance!
P.S. I have zero experience in VBA/VBS, so I'm hoping to realize this in a normal formula.
There are ways to make it more compact, but they will necessarily make the function more complicated, so it wont be any easy win. See for yourself:
you basically need to be able to cycle through the years inside formula without creating custom formulas. One way to do this is to use ROW inside INDIRECT function. This way you can replace multiple
Table2015[Place]
with one array function containing
INDIRECT("Table"&ROW($A$2015:$A$2018)&"[Place]")
as it is an array function it will essentially cycle through the cells in the ROW function creating Table2015[Place], Table2016[Place], Table2017[Place] and Table2018[Place]. Your whole formula would look something like this
=SUM(COUNTIFS(INDIRECT("Table"&ROW($A$2015:$A$2018)&"[Place]");B3;INDIRECT("Table"&ROW($A$2015:$A$2018)&"[Activity]");{"Paid";"Awarded"}))
and it must be entered using ctrl+shift+enter (you will see {} brackets around the function). This should work to make the function smaller and you will need only to change the cell reference each year instead of adding another sum, but the question is if the separate sums are not easier to read and maintain.
I am new to Stackoverflow, so please let me know me if there is not enough information. I have had many helpfull insights by using StackOverflow in the past, but I cannot find any helpful thread online, so I hope you can help me.
I've been working on a excel (2013) problem for a while now. I am trying to build a marketing agenda to store and keep track of our mailing campaigns. The campaigns themselves are send via another system, but we miss the ability to plan our mailing campaigns in advance. Since we are active on different markets in Europe, we decided to have a general mailing (for all regions) and a region specific mailing campaign (both are in the same agenda). Besides this we also want to display the mailing focus (different brands). It is my idea to return this as visual as possible (to make it usable for all users). I have add a small picture to show my desired end-result (however without any data at this moment).
At this moment, the users are going to use a (Google)form to enter the campaign information and this data is downloaded to the worksheet (by doing so all users can add new campaigns and everyone always has access to the most recent data). This part works well.
I am using a helper sheet to check if the dates fall in a campaign range, if it does fall in a campaign range it should return the mailing ID (also the row number). I have another form which uses this data to search for the right brand and displays visually (with a lot of conditional formatting).
The problem arises in the helper sheet (when I check if a date fall into a campaign range). I have been able to get it working (more or less) with the following formula:
=IF(SUMPRODUCT(--(CountryHelper!$C$2:$C$100<=$B4);--(CountryHelper!$D$2:$D$100>=$B4);RIJ(CountryHelper!$C$2:$C$100))=0;"";INDEX(CountryHelper!$A$2:$A$100;SOMPRODUCT(--(CountryHelper!$C$2:$C$100<=$B4);--(CountryHelper!$D$2:$D$100>=$B4);ROW(CountryHelper!$A$2:$A$100))))
In this formula, CountryHelper!C:C is referencing the StartDate of the mailing campaing. D:D will reference the column of the EndDates and A:A has the mailing ID. Cell B4 is the date that needs to be checked.
At first it looked this worked perfectly. If a date fell in a date range then it would return the ID. After a little playing around with this a problem came to light. It only works with non overlapping dates, once dates overlap excel will add the row numbers together and it would not work any more.
Is it possible to get the sumproduct formula working and returning only the first ID. I am aware that I then have to make another 2 formulas which return the second and third ID ( I am certain we do not get more than 3 overlapping dates). This is also the part where I get lost. I've tried to use a MIN and MAX variation wit the following sumproduct formula:
=SUMPRODUCT(--(CountryHelper!$C$2:$C$100<=$B4);--(CountryHelper_RSEU!$D$1:$D$100>=$B4);ROW(CountryHelper!$C$1:$C$100))
This will return either a 0 (with MIN) or 100 (With MAX). I think this is caused by the formula (for now it only searches the first 99 rows). I also have ventured into VBA / UDF to get this done, but as I understand it this is not possible.
Anyway, I am sorry for the long story, I hope that my problem is clear and you can help me. If you need any more information.
Thank you!
empty Marketing Agenda overview
The SUMPRODUCT is a kind of swiss army knife Excel function. But here it is wrong because, as you already have seen, it really calculates a SUM at the end. Mostly it works because it first multiplies the 0 or 1 of the conditions with the row numbers so only the row numbers which fulfills the conditions comes into the sum. But if two or more row numbers fulfil the conditions then they were added together.
Are you familiar with array formulas? The following array formula should be what you want:
{=INDEX(CountryHelper!$A$2:$A$100;MIN(IF((CountryHelper!$C$2:$C$100<=$B4)*(CountryHelper!$D$2:$D$100>=$B4);ROW(CountryHelper!$A$2:$A$100)-1)))}
To create a array formula put the formula into the cell without the curly brackets and then press [Ctrl]+[Shift]+[Enter]. Then the curly brackets should appear automaticaly.
How it works:
{IF((CountryHelper!$C$2:$C$100<=$B4)*(CountryHelper!$D$2:$D$100>=$B4);ROW(CountryHelper!$A$2:$A$100)-1)}
Gets a array of row numbers or FALSE {FALSE, rowNumber, FALSE, ...}. If both conditions are fulfilled then it gets the row number - 1, if not then it gets FALSE.
The MIN function then gets the smallest (row number - 1) from this array.
The INDEX then indicates this smallest (row number - 1) which fulfills the conditions.
It subtracts 1 from the row number because your INDEX range starts at row 2. If the row number 2 fulfills the conditions then it is the index 1 within this range, if row number 3 fulfills the conditions, it is the index 2 and so on.
Why it only works as array formula? Because the IF function do not creates a array by default even if their "Value_if_true" is a range. Within the array context it does exact this.
i have a little problem with final formulas in one of my column. How to start. maybe i will explain what i have a then what i want.
i have an excel worksheet with 3 sheets. i want to record goods and what are these goods made of. first is sheet called Goods where is possible to put number of goods i want to make. In this case i want to make 1x sandwich1 and at the same time 3x sandwich2. i dont want make sandwich3 this time.
Second sheet is Matrix sheet where I record every good and what it is made of. This sheet is basic sheet and all other sheets take list of goods (resp. ingredients) from this sheet. Simply when i want to make sandwich1 i look at matrix and know that i need 1x1pc of egg + 1x5g of cheese. And for 3x sandwiche2 i need 3x10g of sausages.
Final sheet is called Ingredients. It is a list of used ingredients from Matrix sheet (exactly same order) to make these sandwiches. I want to fill formulas into column B which would go through one ingredient ofter ingredient and count needed amount of it. So it would look into matrix in the same row and where there is some number it would multiply with number of items from Goods sheet. The list of goods is also in the same order as in the matrix sheet.
I hope you understand now what i want and will try to help me. I think there will be SUMPRODUCT, SUMIF and maybe INDERECT functions but i am not that skilled in excel
thanks for any suggestions
You can use MMULT function here - it's an "array formula" which you need to enter in a range. You can do that like this:
In Ingredients worksheet enter this formula in B2
=MMULT(Matrix!C2:E4+0;Goods!B2:B4+0)
[I'm assuming you have a European version of Excel where ; is used to separate arguments]
Now select the whole range B2:B4, press F2 key to select formula and hold down CTRL and SHIFT keys and press ENTER. This "array enters" the formula in the range and you should now see curly braces like { and } around the formula and also the correct results.
You cannot change part of that array now, only the whole thing
Note that I'm assuming that the contents of Goods!A2:A4 will be the same as Matrix!C1:E1 and in the same order. You can extend the ranges to be as large as you like as long as that principle still holds
I suspect that this is an issue of "when all you have is a hammer, every problem is a nail". For reasons known only to you you are using a spreadsheet to solve a problem that databases were made to do. Any solution to this problem in a spreadsheet will be entirely dependent on the integrity of your data - add another column or get things out of order and it will fail.
That said, what you have in your link is effectively a pivot table and what you need is the unpivoted version of this - the instructions for getting this are here.
When you have that, you can use the various database functions in excel to get your answer.