If formula for multiple arguments - excel-formula

My Argument is as follows
Price Range Commission
1500>= 500
1499-201 50
200-175 25
174-51 20
50-1 10
How can i write an IF formula for this

This would be easier with a Table and VLOOKUP.
First create a small table using the minimum thresholds in one column with the commission in another:
Then a simple VLOOKUP will do what you want:
=VLOOKUP(E2,A:B,2,TRUE)
The advantage to this method is that if the commission rates or thresholds change one does not need to change the formula just the table in which the data resides.
If you really want an IF function to do what you want:
=IF(E2<51,10,IF(E2<175,20,IF(E2<201,25,IF(E2<1500,50,500))))
Where E2 is the price of the good sold.

If prices are in column A, beginning at A1, you could copy this formula down column B, starting at B1
=if(A1>=1500, 500, if(A1>=201, 50, if(A1>=175, 25, if(A1>=51, 20, if(A1>=1, 10, 0)))))

Related

Displaying a label, sorted in a third column pulled from the first column according to data in the second column? i.e. Ranking

Imagine you have spreadsheet with data in a fixed # of contiguous rows.. let's say row 1 through row 20
Now let's say you have 3 columns of interest.
A, B and C
Column A is a label column.. the data in there are just string labels.. let's say types of canned food.. Tuna, Spam, Sardines, etc.
Column B is our number column.. let's say it is prices. e.g. 2 for Tuna, 5 for Spam and 3 for Sardines. These prices can change often very rapidly.. ok so prices are not the best example but let's imagine that prices change rapidly.
Now Column C is where we want to put the formula.
I would like to have a formula in Column C that will pull the labels from Column A, based on their prices in column B and rank them from highest to lowest.. that is C1 would calculate to "Spam", C2 to "Sardines" and C3 to "Tuna"
right now there are 20 rows of data.. but maybe at some other point there might be 30 or 6 or 40, etc.
So can someone help me out with the formula or at least explain what functions I need to use and the general idea involved? thanks
=IF(A2:A200<>"";SORTBY(A2:A200;B2:B200;-1);"")
You can simply use SORT formula. In this case =SORT(A1:B1000,2,-1) where A1:B1000 is range to be sorted, second parameter 2 is column number from range to sort by, 3rd parameter for order (-1 is desceding).
Place formula in C1 and you will get spilled array.

Excel: Rounding up Nearest value

Click HERE for excel file.
In the Excel file based on Column B values I am finding nearest up offer price range which is in Row number 2 in Grey Color, Offer price per sqm is incremental by $50. As you can see in Yellow color values are multiplied by offer price * Land sqm.
3rd property nearest offer price range is $750. As you can see I am using multiple columns from C, D, E, F.
Instead what I want is get the "Offer Price per/sqm" value in column "G". How to do that.?
Though you are not pretty clear about the output you want, I think you want to round the offer price to nearest 50. If so, use this in G3 (and copy down)
=MROUND(A3/B3, 50)
this will return $700 as nearest offer price. However, if you want to round only upwards i.e. towards $750, use this (and copy down)
=CEILING(A3/B3, 50)
If you want either of these formulae to return values between 650 and 800 only use either of these
=IF(AND(CEILING(A3/B3, 50)>=650, CEILING(A3/B3, 50) <=800), CEILING(A3/B3, 50), "NA")
Based on your comment, perhaps you need this?
=IF(AND(CEILING(A3/B3, 50)>=650, CEILING(A3/B3, 50) <=800), CEILING(A3/B3, 50)*B3, "NA")
I wonder if this is what you want.
[G3] =B3*INDEX($C$2:$F$2,1,MATCH("x",C3:F3,0))
You would mark the appropriate column with an "x" and the formula would multiply the price in row 2 of the first marked column with the number of sqm.
To simulate your example, an "x" would be placed inE3 and F3. The formula in G3 would ignore the F3 and show the price based on E2. If you add an "x" in D3 the lower price will be shown in G3.

counting of gender based upon age distribution

I have an excel sheet of data. I have to prepare report based on gender and age wise distribution count. The excel sheet has three columns NAME, GENDER, AGE. I have to get the count of Male, Female Population according to age distribution of
Under 10
10 yrs - 18 yrs
19 yrs - 49 yrs
50 yrs - 59 yrs
Above 60 yrs
How can I get the count in excel? I have no idea of excel programming. Attached herewith is only sample data I have thousands of rows of actual data. I have no idea how to do such analysis in excel. Please help!!!
I've attached the data as well as required count format in the image.
#Ted Williams, I didn't find a solution as you suggested. I failed to get rows or columns for each of the five age groups into the pivot table. So, I guess the task you set for OP was too difficult. Instead of a pivot table I used the formula below to assign each age to one of the five age groups.
[D2] =MATCH(C2,{0,10,19,50,60},1)
Next, I built a copy of your "Reporting Format" table in A17:K18 - five age groups with 2 columns each, just as you published it. Then I entered the next formula in B20 and copied all the way across to K20.
[B20] =COUNTIFS($B$3:$B$15,B$18,$D$3:$D$15,INT(COLUMN()/2))
Column D of the table this formula references contains the age groups already mentioned above and column B contains the gender. This table was copied form the data table you posted, assuming that the names are in column A.
INT(COLUMN()/2) is a counter which is built on the the original formula being in column B. COLUMN() returns the number of the column in which the formula resides. If the original is in column B it will return 2, 3, 4, 5, 6, 7, 8, 9, 10 as it is copied to B20:K20. Dividing this number into 2 will create a fraction which we can't use to address column numbers but the INT() function will round that fraction down. So, the result of =INT(COLUMN()/2) will be 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, exactly the age groups we have in column D and, of course (hopefully) the age group captions we have in row 17. The point of this explanation is that this function may return the wrong result if the original is not in column B. Adjust it like this, =INT((COLUMN()+x)/2) (where x is likely to be a negative number) and test it by itself in the columns in question to ensure that it returns the numbers 1 to 5, each number twice.
Here's what I meant:
Binned Age is from the table in H:I using index/match formula.
Pivot table uses BinnedAge then Gender for columns and count of name for values
If you want the bins sorted in a different order in the pivot table then see:
https://www.excel-university.com/sort-a-pivottable-with-a-custom-list/

SUM values with VLOOK

I have an Excel sheet with monthly costs per food. The goal is, on a part sheet, to calculate the value of each food in every month. With a formula I am using at the moment =SUM(VLOOKUP (A3; Food! C3: K3000; 7; 0)), it is only looking for a relative value in the first month and not in the total of all months.
To clarify the formula:
A3 is the food I'm looking for;
Food! C3: K3000 is the range of the table where I am looking for the data;
Finally, 7 will be the column index where the amount spent per month is.
This is what I have in Food sheet:
I think there is no extra information. If something else is left, please tell me.
That's the result I want:
You can use SUMIF:
=SUMIF($B$3:$B$11;G3;$C$3:$C$11)

Median Selling Price Excel Table

I have a spreadsheet with different products, listing units and retail value sold like the example below
Product Units Value
A 10 100
B 15 80
C 30 560
I'd like to compare the Average Selling Price with the Median Selling price, so I am looking for a quick formula to accurately calculate the median.
The median function requires the entire series, so for Product A above I would need 10 instances of 10 etc. How can I calculate the Median quickly considering the condensed form of my data?
Without writing your own VBA function to do this there are a couple of approaches that can be taken.
The first expands the data from its compressed frequency count format to generate the full set of observations. This can be done manually or formulaically. On the assumption the latter is required, it can be achieved using a few columns.
All the blue cells are formulae.
Column Eis simply the cumulative of column B and F is an adjusted version of this. Column H is just the values 1 to 55, the total number of observations given by cell L2. Column I uses the MATCH() with its final argument as 1 to match each observation in H against the adjusted cumulative in F. Column J uses the INDEX() function to generate the value of the observation. (Observations 1-10 have value 100, 11-25 have value 80 and 26-55 have value 560 in this example). The MEDIAN() function is used in cell M2 with column J as its argument.
This approach can be refined to take account of varying numbers of products and data points through the use of the OFFSET function to control the range arguments of the MATCH(), INDEX() and MEDIAN functions. And, of course, adjacent cells in columns I and J could be combined using a single formula - I've shown them separately for ease of explanation.
The second approach involves sorting the data by value (so in this case the data rows would become Product B in row 2, product A in row 3 and product C left as-is in row 4). It is then a case of identifying the middle observation number (if the number of observations is odd) or the middle pair of observation numbers (if the number of observations is even) and then determining the value(s) corresponding to this/these middle observation(s). In this approach the adjusted cumulative in column F is still used but rather than explicitly calculating the values in column I and J for every observation it can now be restricted to just the middle observation(s).
I think there is no way around compromises. Either using big amounts of helper cells or having the table sorted by the values.
Helper cells:
Formula in F4:AS6:
=IF(COLUMN()<COLUMN($F$4)+$B4,$C4,"end")
Formula in D2:
=MEDIAN(F4:AS6)
Sorted:
Formula in F4 downwards:
=SUM($B$3:B3)+1
Formula in D2:
=SUM(LOOKUP(INT(SUM(B4:B6)/2+{0.5,1}),F4:F6,C4:C6))/2

Resources