In Excel, "if greater than 0 and less then 10 then "x", but if greater then 10 and less then 20 then "y" in same cell - excel

I am trying to create a formula to calculate shipping based on price but I have only been able to find this:
=IF(AND(D2>0.01,D2<13.51),4.51,"")
Basically it reads "If the total purchase (D2) is greater then $0.01 and less then $13.51 apply $4.51 as the shipping fee. This works for the one fee but I need it to apply the other fees as well and I cannot seem to figure out how to do multiple greater than, less than in one formula.
So I need to be able to add multiple of that same code and change the numbers, but I can't figure out how to do multiple without getting an error.

VLOOKUP with approximate match sounds like it would be the easiest if you have a lot of shipping prices. The lookup table is in grey and you can setup however you like. If column 'B', put the formula =VLOOKUP(A2,$D$2:$E$5,2,TRUE) The TRUE is was provides the approximate match.
A nested IF would work, but would be horrible to manage. Using the VLOOKUP, anyone could maintain the lookup table.

Related

Is there a way I can count a specific string (Product) in a column times by the neighboring cell (Quantity) so show how much of a product I have sold [duplicate]

I'm wondering if there is an easy way to do what I'm looking for. Basically, I have a balance sheet in Excel 2011 with a bunch of data. One specific piece of information I always want visible is the amount that hasn't been reimbursed. In other words, I have a column for the amount paid and another for whether or not it has been reimbursed (Yes/No). I want to sum all of the amounts paid where the reimbursed field is equal to 'No'.
I recognize I can sum the entire column and filter out those that have been reimbursed, but I'd like it to display the full amount regardless of what filter is on (or if no filter is on).
I wasn't able to find good keywords to describe this to Google, so I'm asking here. I would like to accomplish this in Excel, not in an external program or script.
If column A contains the amounts to be reimbursed, and column B contains the "yes/no" indicating whether the reimbursement has been made, then either of the following will work, though the first option is recommended:
=SUMIF(B:B,"No",A:A)
or
=SUMIFS(A:A,B:B,"No")
Here is an example that will display the amounts paid and outstanding for a small set of sample data.
A B C D
Amount Reimbursed? Total Paid: =SUMIF(B:B,"Yes",A:A)
$100 Yes Total Outstanding: =SUMIF(B:B,"No",A:A)
$200 No
$300 No
$400 Yes
$500 No
You could do this using SUMIF. This allows you to SUM a value in a cell IF a value in another cell meets the specified criteria. Here's an example:
- A B
1 100 YES
2 100 YES
3 100 NO
Using the formula: =SUMIF(B1:B3, "YES", A1:A3), you will get the result of 200.
Here's a screenshot of a working example I just did in Excel:
You should be able to use the IF function for that. the syntax is =IF(condition, value_if_true, value_if_false). To add an extra column with only the non-reimbursed amounts, you would use something like:
=IF(B1="No", A1, 0)
and sum that. There's probably a way to include it in a single cell below the column as well, but off the top of my head I can't think of anything simple.

How to create four equal buckets of decimal values

I have an excel table:
JobA .03445
JobB .01366
JobC .93271
JobD .6335
Plus 65,000 more.
What I need to do, is to create four equal buckets based on the values. where the sum of all Jobs in each bucket come as close to the other three buckets as possible.
Is there a way to do this in Excel?
Thanks
You can try this approach based on the incremental percentage. So you sum each incremental job until your sum reaches 25% of total values (that is BucketA), jobs from 25-50% will be "BucketB", 50-75% "BucketC", and rest will go into "BucketD". Sum of values in each bucket should be pretty close since you have 65k of values.
enter this formula
=IF(SUM($B$2:B2)/SUM($B$2:$B$100000)<0.25,"BucketA",IF(SUM($B$2:B2)/SUM($B$2:$B$100000)<0.5,"BucketB",IF(SUM($B$2:B2)/SUM($B$2:$B$100000)<0.75,"BucketC","BucketD")))
in cell C1 and drag it to the bottom.
There's lots of studies into algorithms that solve these types of problems. Your problem is actually the exact same format as the equal piles example in this article:
https://simple.wikipedia.org/wiki/P_versus_NP#Example
Considering the volume you're working with and the fairly narrow range of values, you could get a fairly good approximate solution by simply doing this:
Sort all items in descending order by value
In an adjacent column, put 1, 2, 3 and 4 against the first 4 values.
Use autofill to repeat that pattern against all values
You should now have 4 groups of fairly equal value

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

Ranking function

I am looking for some help regarding ranking. My spreadsheet has columns labeled as follows:
Tickers
P/E Rate of Change
P/B Rate of Change
Dividend Yield Rate of Change
P/Sales Rate of Change
I am looking to come up with a composite ranking that takes into account a tickers relative rank within each rate of change category. I tried this first by creating an additional 4 columns and using the formula as follows:
IFERROR(RANK(D4,$D:$D,1),"")
I believe this gives me a rank for the corresponding rate of change. However, for those cells that have either a blank or an error I want to use a median in calculating the tickers rank. I was then going to sum the ranks in another column to come up with my final ranking but that doesn't seem to be calculating correctly as I have blank rows returning rankings that don't make sense.
I think you are almost there.
For one column I would change what you have to
=IFERROR(RANK(D4,$D:$D,1),MEDIAN($D:$D))
Then simply expand to add all ranks together
=IFERROR(RANK(A4,$A:$A,1),MEDIAN($D:$D))
+IFERROR(RANK(B4,$B:$B,1),MEDIAN($D:$D))
+IFERROR(RANK(C4,$C:$C,1),MEDIAN($D:$D))
+IFERROR(RANK(D4,$D:$D,1),MEDIAN($D:$D))
+IFERROR(RANK(E4,$E:$E,1),MEDIAN($D:$D))
To avoid potentially large numbers you could use an average (same resulting rank, but potentially easier to understand) by slightly changing the formula to:
=(IFERROR(RANK(A4,$A:$A,1),MEDIAN($D:$D))
+IFERROR(RANK(B4,$B:$B,1),MEDIAN($D:$D))
+IFERROR(RANK(C4,$C:$C,1),MEDIAN($D:$D))
+IFERROR(RANK(D4,$D:$D,1),MEDIAN($D:$D))
+IFERROR(RANK(E4,$E:$E,1),MEDIAN($D:$D)))/5

excel rows,find if include,low and high

it seems that i cant post my picture.here is my link to it:
picture: http://s18.postimg.org/nfv997rvd/head.png
Hello Stackoverflow.
I have some things I wondering about here. I'll try to take it step by step:
It is marked in orange color:
As mentioned in the example in the picture it says "headphones". I would like it to search through all the lines in column A, to find something that has that name in it, then it should count the number of people, and come out with the number (in how many)
the "middle price" I want it to take the price of B (depending on where it found it called headphones) and take the average price of it.
In secured, as I would like it to count how many of them (from the number, or from the beginning) that have "secured" as "no" and "yes."
would like to use this on several things.
pink:
where would I find the average price of all the goods, and what the name of the particular item is.
same with the highest and lowest price.
How can I do this?
to find out how many Headphones:
=COUNTIF(A:A,"*Headphones*")
Note the *'s around the word so it can be found anywhere in the text to make a match.
For middle price there are 2 options, depending on how you want to define the average.
If it's a straight average:
=AVERAGEIF(A:A,"*Headphones*",B:B)
If you want the median, then you will have a slightly more complex formula with
=MEDIAN(IF(A1:A100="*Headphones",B1:B100))
and entered as an array formula with Ctrl+Shift+Enter
maximums and minimums can also be found with the same type of array formula
=MAX(IF(A1:A100="*Headphones",B1:B100))
=MIN(IF(A1:A100="*Headphones",B1:B100))
Excel also has COUNTIFS for multiple criteria:
Secure/Not Secure Headphones:
=COUNTIFS(A:A,"*Headphones*",E:E,"Ja")
=COUNTIFS(A:A,"*Headphones*",E:E,"Nei")

Resources