excel if statement having a range in a single cell - excel

At the moment I am working on using on implementing nested if statement in excel for a project. It involves calculating the tax of employees using a tax table and would like to know if it possible for a logical test to distinguish a range within a singular cell i.e $0-$18,000

If you are open to using VLOOKUP, you can create a table showing the range and the associated value with it and use vlookup with the last argument being TRUE (approximate match) to get the value.
This is the output:
1.00 10%
100,000.00 30%
40,000.00 25%
17,999.00 10%
18,000.00 10%
18,001.00 15%

Try nested IF and AND formulas in combination. For example, there are three ranges: 0-18 000, 18 000- 23 000, 23 000<, then use this:
=IF(AND(A1>=0, A1<=18000),"range 1",IF(AND(A1>18000, A1<=23000),"range 2","range 3"))

Related

How to count blank cells using subtotal

So, I am trying to find a way to get the completion percentage of different activities. I already found a way to get it the consolidated value (for all groups without filtering), however now I would like to obtain the the completion when filtering the group. So, this is how my table looks like:
ID
Group
Activity 1
Activity 2
1234
ADMI
11/21/2021
03/08/2021
2234
ENGINEER
blank cell (but with formula inside)
03/05/2021
2134
HR
09/21/2021
03/10/2021
3234
OPERATOR
blank cell (but with formula inside)
05/10/2021
3334
OPERATOR
blank cell (but with formula inside)
01/03/2021
3434
HR
11/21/2021
03/08/2021
If the cell has a date value, then it means that the person did the activity.
If the cell is blank, then it means that the person didn´t perform the activity.
As I mentioned previously I already found a way using: "COUNTA" - "COUNTBLANK" and dividing by the number of employees to get the percentage for each activity without filtering and you can find above the output:
Activity 1 Completion Percentage
Activity 2 Completion Percentage
50%
100%
But now I would like to know how much it would be in case I filter the group. So, let´s suppose that I filter HR, this is going to look like be my desired output:
Activity 1 Completion Percentage
Activity 2 Completion Percentage
100%
100%
I know that I need to use subtotal but it does not appear the option to count blanks. Does anyone know how can I solve this issue without having to use a pivot table?

Excel - how to select the largest values that account for 60% of data

I have 6 rows of data with a cost:
I would like to select the top data entries whose cost account for e.g. 60% of my total cost. Here, the formula would flag Bananas, Lemons and Oranges since it is the selection that covers at least 60% of the total.
I need to select the largest values first.
In substance, I would like to find a function that does the same as
=INDEX($A$2:$A$12, MATCH(LARGE($B$2:$B$12, D3), $B$2:$B$12, 0))
Any clue?
link to file
In this file, the first column represents the cost, the second is the cumulative sum and the last is the percentage of data covered.
Here is a solution using Microsoft365:
Formula in D2:
=INDEX(SORT(A2:B7,2,-1),SEQUENCE(MATCH(TRUE,((MMULT(--(SEQUENCE(1,COUNT(B2:B7))<=SEQUENCE(COUNT(B2:B7))),SORT(B2:B7,,-1))/B8)*100)>=60,0)),{1;2})
Where MMULT(--(SEQUENCE(1,COUNT(B2:B7))<=SEQUENCE(COUNT(B2:B7))),B2:B7) is used to create a running total array.

Allocation of shipments based on ranking (excel based solution)

I have got some list of shops. I have to allocate shipments based on their rankings. The allocation should happen in such a way that each shop should not get less than 25 shipments and more than 100 shipments. The actual question is explained below.
Total SHipments=150
Shop Id A B C D E
Allocation (%) 30% 28% 25% 10% 7%
Min. 25 25 25 25 25
Max. 100 100 100 100 100
Actual Allocation %*150
=45 42 37 15 11
My Requirement 45(>25) 42(>25) 37(>25) 25(<25) 1(<25)
So my requirement is based on the ranking, the excel should allocate actual allocation to the top rankers (Between 25 to 100) and as the ranking goes down, it should fulfil the need of better ranker and make it 25 and then allocate the rest.I think I have made the question clear but let me know if still ambiguity is there. I'm new to this community. Forgive me if I'm not able to post the question in proper way.
To get your required results based on the information in your table layed out in the manner in the screen shot below, use the following formula:
=INT(MIN(MAX($C$1*B$5,B$7),B$9))
The above formula is placed in Cell B16. The INT was used as your results for 37.5 was 37.
In cell C16 place the following formula and copy it to the right as required. This is based on the allocation being in descending order from left to right:
=IF(SUM($B$16:B$16)+INT(MIN(MAX($C$1*C$5,C$7),C$9))<=$C$1,INT(MIN(MAX($C$1*C$5,C$7),C$9)),$C$1-SUM($B$16:B$16))
The max function is used to return the minimum value. When your formula returns a result below the minimum value The max function returns the minimum value. The MIN function does the same when the result of the formula exceeds the maximum allowable value. It will return the maximum allowed value as it is the minimum of the two numbers.
UPDATE: Rank out of order
This does not work when their is a tie and total demand exceeds available shipments
I took your table and added a helper row to determine RANK Row 6. I used the following formula to come up with the rank
=RANK(B5,$B$5:$F$5)
With this method, it is possible to have ties. You can investigate how to come up with unique rank with ties. The rest of this solution will assume the there are no ties in rank.
In Row 11 the "demand" of each shop is calculated based on Max and Min constraints and is rounded down to the nearest integer. The following formula is placed in B11 and copied right:
=ROUNDDOWN((MAX(MIN(B5*$C$1,B9),B7)),0)
In row 13 the actually amount to ship or "supply" is determined with the following formula in B13 and copied to the right.
=IF(SUMPRODUCT(($B$6:$F$6<=B6)*$B$11:$F$11)<=$C$1,B11,MAX($C$1-SUMPRODUCT(($B$6:$F$6<=(B6-1))*$B$11:$F$11),0))
FYI - SUMPRODUCT performs array like calculations within it. As a result, avoid using full column/row references such as A:A and instead reduce the range to your data or something closer to it to avoid a lot of excess calculation which may bog down your system. This is particularly true when the formula is repeated in multiple cells.

Excel: alternative to long IF statement

Trying to calculate the total amount based on different discount factors throughout the term. For example, if a base price is $1,000/month, that will be for months 1 – 24, then $500/month 25-48 and $250/month 49 and after. I think I can do this with IF statements but is there a better way to compute this calculation in Excel?
=IF(B2<=$E$2,A2*B2,IF(AND(B2>=$D$3,B2<=$E$3),(24*A2*$F$2)+(B2-$E$2)*(A2*$F$3),IF(B2>=D4,(24*A2*F2)+(24*A2*$F$3)+(B2-48)*(A2*F4))))
Change your table as shown below, and use the following formula:
=A2*VLOOKUP(B2,$D$2:$F$4,2)+A2*(B2-VLOOKUP(B2,$D$2:$F$4,1))*VLOOKUP(B2,$D$2:$F$4,3)
There is no test done for maximum months. You can add that as an IF if necessary.
This method allows for a lot of flexibility in altering the terms. It is also useful in calculating things like income taxes and other stuff for which there is this kind of "tiering"
EDIT: The formula for the Base column:
E2: 0
E3: =E2+(D3-D2)*F2
and fill down from E3 to the bottom of the table

Calculating my tax automatically in Excel

It's my very first post here so hi all.
I did a lot of research before hand but couldn't find the answer I was looking for.
I want a spreadsheet in Google Sheets to automatically calculate my tax.
€0 - €11000 w/ 0%
€11000 - €18000 w/ 25%
€18000 - €31000 w/ 35%
€31000 - €60000 w/ 42%
€60000 - €90000 w/ 48%
€90000 - €1000000 w/ 50%
€1000000+ w/ 55%
So the first 11k are taxed with 0% the next 7k are taxed with 25% etc.
What I've had the following thought - give that F9 are my before tax earnings:
=IF(0<=F9<=11000,SUM(F9*0%),(IF(11000<F9<=18000,SUM((F9-11000)*25%),(IF(18000<F9<=31000,SUM((7000*25%)+((F9-18000)*35%),SUM(F9))))))
Unfortunately it just won't work.
Am I using the right function?
Is there anything out there which would make it much easier?
Thank you for your help.
Here is an example (Excel) for your problem:
In Cell A1 is your Money, paste the code in A2 for example:
=WENN(A1>10000;"10%";WENN(A1>7000;"7%";WENN(A1>5000;"5%";WENN(A1>3000;"3%";"0%"))))
FK
Excel does not work that way X<y<z. Plus it resolves in order so it is not necessary:
=IF(F9<=11000,SUM(F9*0%),(IF(F9<=18000,SUM((F9-11000)*25%),(IF(F9<=31000,SUM((7000*25%)+((F9-18000)*35%),SUM(F9))))))
if it is less than 11000 then the first will fire and none others. then if greater than 11000 but less than 18000 the second will fire, and so on.
List values of each bracket range with the percentage applied if it is above that amount, for example:
A B
1 11000 0.25
2 18000 0.35
3 31000 0.42
4 60000 0.48
5 90000 0.50
6 1000000 0.55
You can format the percentage values as percentages if you prefer. What is important is that the value is a decimal and not a string.
Then you can use the MATCH function to determine the row of the first value that is larger than your income. So if the cell holding your income is F9, you'd have:
=MATCH(F9;A1:A6;1)
But this only returns the row number. If we want to retrieve the tax applied, we'll need to use this to pinpoint the value in column B pertaining to that. To get a value pertaining at a certain point dynamically, we use INDEX.
So putting it together, you'd have:
=INDEX(B1:B6; MATCH(F9; A1:A6; 1); 1)
One minus this times the value in F9 to get the amount after taxes:
=F9*(1 - INDEX(B1:B6; MATCH(F9; A1:A6; 1); 1))
Why would you do it this way? It lets you change the values in an intuitive fashion without having to parse a long and arduous formula. You can also add new values with relative ease. Just remember to adjust the A1:A6 and B1:B6 ranges.
Good luck! Let me know how it turns out!
You might want to try this:
=if(F9<=0,"Error",IF(F9<=11000,0,(IF(F9<=18000,(F9-11000)*25%,(IF(F9<=31000,1750+(F9-18000)*35%,IF(F9<=60000,6300+(F9-31000)*0.42,if(F9<=90000,18480+(F9-60000)*0.48,IF(F9<=1000000,32880+(F9-90000)*0.5,487880+(F9-1000000)*0.55)))))))))

Resources