# Calculate A Multi-variable Equation Based Off Of Data In A Table With Different Criteria

Jan 8, 2010

I'm trying to calculate a multi-variable equation based off of data in a table with different criteria. If you reference the attached spreadsheet I am trying to calculate cost based on weight and zone. For the data entered in cells B1 and B2 944.01 would be the cost. If you look at the table in G2:N3 you'll notice that the values in G2 and G3 are the weight limits G2 is from 0-4999 and G3 is 5000+, this should impact where the value in B1 falls. B2 should select from H1 to N1.

## Formula To Calculate User Fees Based On Variable Rate Table

Nov 15, 2013

I am looking to setup a formula to calculate a Fee that is based on the number of users of a service in a month, with the rate varying by the number of users. The first million users in a month will bring in \$0.40 per user, for users 1-4M it will bring in \$0.30 per user, for users 4M-7M it will bring in .20 per user, and for users beyond 7 million it will be .10 per user. So for example, if a user count was 9 million in a month, the calculation would be (\$0.40 x 1 million) + (\$0.30 x 3 million) + (\$0.20 x 3 million) + (\$0.10 x 2 million). I know the answer to the problem is obviously \$2,100,000 but I can't build the formula that solves that and can handle instances where the user count is capped in one of the individual brackets. (IE if there are 3.5M users)

I've attached an example spreadsheet : Variable Fee Schedule.xlsxâ€Ž

## Multi-Variable Lookup Table

Jun 12, 2014

I make budgets that have line items that have standard price based on 2 factors: a description, and a number. I want to keep these items in 2 different cells. I also have different clients, and the costs are different. I could simplify so that I can use a VLOOKUP with HLOOKUP and separate the clients but I would prefer not to.

Screen shot 2014-06-12 at 12.36.47 PM.png

## Calculate Data Based On Laid Down Criteria?

Jul 26, 2013

I am trying to create a sheet which will automatically calculate data based on laid down criteria.The criteria are as follows:

Cab Type in cell () Indica

If the value of cell () is less than or equal to 40Km then cell (B3) will be 400.

For every extra km above 40 the cell value in cell (B2) will be extra km done multiplied by 8 in cell (D2)

If the value of cell () is greater than 40 but less than or equal to 80 then cell (B3) will be 800

For every extra km above 80 the cell value in cell () will be extra km done multiplied by 12 in cell (D2)
Cab Type in cell () Indego

If the value of cell () is less than or equal to 40Km then cell (B3) will be 600.

For every extra km above 40 the cell value in cell (B2) will be extra km done multiplied by 14 in cell (D2)
If the value of cell () is greater than 40 but less than or equal to 80 then cell (B2) will be 1200

For every extra km above 80 the cell value in cell (B2) will be extra km done multiplied by 16 in cell (D2)

Ther are about 5 different types of cabs in the sheet.

Cab Type Provided
Total KM run
Basic Amount
Extra km

What I want to achieve is as under:

1. If value of cell A1 = Indica and value of cell B2 is entered as 40

Then the values of cells (C2:e2) should populate automatically as 400, 0, 400

2. If value of cell A3 = Indica and value of cell B3 is entered as 40

Then the values of cells (C3:e3) should populate automatically as 400, 40, 440

## Calculate Profit And Loss Data Based Off Lots Of Account Criteria?

Jun 15, 2014

I'm trying to design a Profit and Loss template that calculates off an accounting software data dump. I will attempt to explain the problem here but I have included a summary in the linked workbook which would be easier.

I have two problems:

The Formula: Basically, I need to calculate every cell in the Profit and Loss statement based on the below criteria: The Profit and Loss item accounts, e.g. Gross Income has 6 accounts. There is a reference table for these - so incorporate index match/vlookup? User selected data from 4 combo boxes.

I am thinking a SUMIFS formula (using the combo box values) and somehow combining a vlookup to pull the items accounts. I'm starting to think that VBA is the best method?

Tweaking: The attached workbook is a small example. The full data dump contains 60,000 rows.

## Multi-Criteria Sum Based On Multiple Column Cells

Dec 30, 2008

I have a large worksheet that lists employees and the hours they work each day in a pay period.

For Example:

Column A holds a date and Column E holds the number of hours worked for a paytype. So i want to create some function that sums the numbers in column E, but only those where column A holds a date.

Then i want to return that number to a cell, say C20. I think I've managed to tell the macro which rows i want to return values from, but I can't figure out how to say "add these numbers together and put the total in C20."

I'll check this frequently if clarification is needed.

## Counting Text Fields Based On Multi Criteria

May 12, 2006

Trying to count the number of fields that meet a criteria base in 3 different columns. Worked on this for few hours but still keep hitting the wall of no right answer. I have attached an example sheet.

Trying to find the Number of fields that are not blank in the range of B9:B28 and have no date (are blank) in range(C9:C28) and have a number that is < 7 in range (D9:D28).

## Populate Data In Table Based On Dropdown Criteria?

Jul 7, 2014

I've been trying to get a table to populate based on a couple of criteria. However, I've not come-up with the solution yet.

I have my dropdown selections in cells C2 & C3. The objective is to populate the table below the dropdown with data from the sheet named (very unimaginatively) 'Data'. Currently you see the selection AA-11 & Mar-14 in the Contract ID & Month cells. If I change this, the table below should auto-populate.

I've attempted using Vlookup, Index-Match. But it does not give me the desired result.

Also, the number of Products can change each month (although the file shows 4 for each month & each Account).

## Calculate Best Fit Equation Of Curve

May 16, 2008

I am trying to calculate the equation of a curve which best fits some data. On the x-axis is date and y-axis the readings. The curve is quadratic, so on the chart I am fitting a 2nd order polyomial and displaying the equation. To prove that the equation the trendline gives me is reasonable, I am applying the equation on the x parameter to get the y parameter estimate and looking to see the error between predicted and actual - see attached.

The equation and the output from it are clearly rubbish, even though on the graph the trendline is a reasonable fit - see attached. Has anyone any ideas why? I think it has something to do with using a date on the x-axis but no idea why. Is there a way to correct for this? I also tried using the following I to calculate the coefficients which came up with a reasonable forecast (although linest should only be used for linear data): =LINEST(C3:C15,B3:B15^{1,2,3})

## How To Arrange Data Range Into New Table Based On Multiple Criteria

Aug 27, 2012

I have a problem whereby I have a list of data that has a date, a transaction and a balance. I want to be able to rearrange this data into multiple tables, one for each month.

The pictures below explain the situation better, on the left is the list of data I need to sort, and on the right is how I'd like the data displayed. So for the May columns I would like to display all transactions that happened in May and, depending on whether it is an income or an expense, the amount in the corresponding column.

i.e. so the finish result looks something like this:

## Hide/Show Pivot Table Data Based On Criteria

Dec 12, 2007

I want to write a VBA code, so I can apply dates criterias to my pivot table. Say, I have 1-Dec-2007 in "C2" and 10-Dec-2007 in "C3". Now I want my pivot table to show me the dates between those two dates and the data that goes along with it. I have written this code, but it keep debugging:

Sub FilterDates()

Application. ScreenUpdating = False

Sheets("PnL").Select

Sheets("PnL").PivotTables("PivotTable3").PivotFields("Date") _
.PivotItems("01/01/1950").Visible = True 'to always have 1 populated

## Table To Calculate Interest With Variable Withdrawals For Loan

Aug 2, 2014

I have been loaning my brother money over the past 14 months. The loans have been in the form or \$1000 per month plus random payments for one-off expenses like doctors fees. He's not paid anything back yet but we want to know what the total owed is for interest of 10% per annum.

I can easily create a table with payments I've made and the dates with a running total of how much I've paid but how to I create a running balance of what he owes over time based on adding in interest. This might end with a one-off payment in a couple of months, I'd like to calculate what is owed there as a minimum.

## Hide/Show Pivot Table Data Based On Date Criteria

Feb 22, 2008

I have looked at the below Hide/Show Pivot Table Field Items help web pages:

Hide/Show Pivot Table Field Items
Hide Pivot Table Fields Pivot Items by Criteria

I am trying to use the above, but with dates in the following format in each cell:

YYYYMM
200612
200701
200702
200703
200704
200705
200706
etc, etc

The below code is working for >200702 and removes all years/months prior to this entered value. Unfortunately the code does not work when a user enters <200706, instead the code goes through to the “NonValidCriteria” prompt.

Sub HideByCriteriaYYYYMM()
'Declare variables
'SEE: [url]
'SEE: [url]
Dim pt As PivotTable, pi As PivotItem
Dim lMonth As Long
Dim strCri As String, strCri1 As String, strCri2 As String
Dim bHide As Boolean
Dim xlCalc As XlCalculation

## Copy Data Table Seperate Sheets Based On Column Criteria

May 12, 2008

I need to copy all the work sheets into one single work sheet (mastersheet). The source work sheets are having same column structure. The condition which i need to take care of is that after column 3 if at all there is any data till column 10 then in the destination mastersheet these should be copied in different rows with first two columns repeated. I need to do this using VBA macro.

## Set Up An Equation For An Unknown Variable In A Formula Equal To 0

Nov 1, 2008

how to set up an equation for an unknown variable in a formula equal to 0 (an Even-Money Probability Formula for Risk Arbitrage assessments).

The formula is as follows, where I am attempting to solve for Pe:

(Pe*EP)+(P2*EL)=0

Pe=even money probability (placed in column B1 in Excel)
EP=expected profit if deal closes (placed in column B2 in Excel)
P2=probability of deal breaking up (=1-Pe) (placed in column B3 in Excel)
EL=expected loss if deal breaks up (placed in column B4 in Excel)

B1*B2)+(B3*B4)=0

So, once again, I am attempting to solve for Pe, or column B1

B1=(-(1-B1)*B4)/B2

say, EP (or B2) =\$2.00 and EL (or B4)=-\$4.00

B1=(-(1-B1)*-4)/2

B1=2*(1-B1)

## Expand Table To Include Missing Times From Data And Sort Based On Multiple Criteria

May 6, 2014

I have a set of data (assume 2 columns, one with a long name and the second with a time). The names contain variables that must be used as criteria (a single entry may contain "Blue" and "On"/"Off") and times vary, based on when the Name turns "On" or "Off" [in minutes: 25 (On), 47 (Off), 89 (On), 100 (Off) and 137 (On)]. I need to create another table that automatically inserts values for all times, to include the missing times (0 min thru 24 and 26 thru 46, etc.). EX: If the first entry is "Blue-On" at "25 minutes", the cells from 0 minutes to 24 minutes are each "0" and become a "1" at 25 minutes - the following cells are "1" until 47 minutes (where it is turned off). (1 and 0 represent "On" and "Off", respectively)

How can I created a formula to insert the correct numbers into the correct places? I'm willing to have multiple cells with formulas and simply hide the columns that are doing the calculations.

## Exact Criteria In 2-variable Table

Jun 26, 2009

This is probably so simple for an Excel wiz, but I've drawn a blank.
I have a 2-axis table, with the formula =DCOUNTA(Data,"Function",B15:C16) in the top left intersect cell. Data range is the table of info, which has location and function column. Location has values UK and Ukraine.............yes, you've guessed it, the UK row of the table returns both UK and Ukraine numbers.
The criteria range B15:c16 has Function and Location as headings and blanks underneath. The data table references B16 and c16 as the row and column variables.
How can you modify the criteria or table formula not to use starting-with criteria but exact matches ? (probably have to use another formula besides an array version of dcounta, right ?)

## Min / Max Formula Output Cells (Multi-Step Data Table)

Oct 28, 2013

I have a long chain of formulas calculating the return on a particular investment in equipment. We'll call the inputs A, B, and C, and the output (total savings generated) Z. There are several set combinations of values for A, B, and C that I'm interested in generating a summary report for.

There are a number of steps in-between the inputs that I'm interested in, all of which are necessary to get to the output, but is there a good way to have excel chart inputs and outputs without filling out the intervening data?

I suppose the whole thing is essentially a multi-variable, multi-step data table.

## Lookup Values From A Multi Dimensional Table / Data Sheet

Oct 24, 2007

I have a sheet that has to look up value on a report from a sheet sheet that has more than value. Ex)
On the report I have values 123A and 1234A
On the data tab I have table that has.

Ref Tot Value Desc Value1 Value2 Value3
1 123A Widgets 1 2 3
2 123A Widgets 4 5 6
Ref Tot Value Desc Value1 Value2 Value3
1 123B Nuts 7 8 9
5 123B Nuts 1 3 5
Ref Tot Value Desc Value1 Value2 Value3
7 1234A Bolts 2 4 6
11 1234A Bolts 3 5 8

So the report need find the values for Value 1, 2, 3 on where the value matches the data tab.

## Calculate Difference Based On Criteria

May 5, 2013

I have a number which consist of 12 digits such as 765432123345. The first two digits denotes the year. I need to create a formula in the next column to calculate the difference in years by comparing to the current year of 2013. In this scenario, the difference will be 37. Is there a way to do this?

## Calculate Increase Based On Criteria

Jan 17, 2009

We typically give out Free Rents (usually a few months) to our tenants, which is always up on the front. And then we would charge a rent increase (\$.50 per year in the example) starting 12 month after the rent free rent ends and every year (12 months) afterwards. The rent will be flat between each increase. My questions have two parts:

1. Is this something array formula can handle in one formula?

2. Since I am not an expert on array formula, what I ended up doing was to create a line for "Rent Bump Date" which is defined as the Free Rent + 13 for the 1st rent increase (meaning if you dont get free rent you would start paying increase in month 13 and every 12 months after. And I put in what the rent would be for each rent bump date. My solution is if the rent for each month (1 - 240) would be determined based on the ranges of those bumps. For example,

Month 1-15 Rent \$20
16-27 20.50
28-39 21
40-51 21.5
52-63 22
64-75 23
......
......
......
232-243 30......................

## Calculate Wages Based On Criteria

Jun 8, 2006

I am working on my companies tax reports for the first time. The wages for unemployement and FUTA do not calculate IF the total wages are over a certain amount.

Im trying to get the formula to see if the total wages are over \$7000 then dont calculate. Ive tried several different things from the links, but still can't make it work.

total wages are \$7800, so i only need to calculate it on \$7000 and then not calculate it again for the next quarter.

## Calculate Percentage Based On Criteria

Jul 29, 2006

I have events in column 1,in my sheet there are about 800 events.

In col 2. each contestant has a label,blue(b),green(g) or red(r)

In column 3 I want to print the % of blue + green of the total for each event,

e.g first event in attached sheet would show 77.7% down to row 10 in col 3 etc.

## Formula To Calculate Based On Criteria

Apr 20, 2007

I have a spreadsheet that has staff id in one column and the work items number that they have done in a daily basis in another column.

The actual list is very long. I need to summarize in another column how many work items that they have completed in a daily basis.

I have attached a sample spreadsheet as an example. I would need to summarize in column H based on the staff ID. Some work items are shared by two staff but it will have to be counted as one work item completed for each staff. If work item B123466 is completed both by staff M56 and M54, then it will be counted as one for each.Currently, I am doing this manually with the filter function which is very tedious and often has mistakes. I would like to formularize this task.

## Calculate Rank Based On Criteria

May 20, 2007

I want to calculate the sales rank of the customer whose CUSTOMERID is equal to my ID? Note that sales rank is what position the salesperson is in terms of DOLLAR VALUE OF SALES.

Just a bit stuck on this. How do I calculate the rank? Is it a If statement or a Vlookup Question?

The spreadsheet can be found here: http://www.megaupload.com/?d=5D0YCHIG (It's too big to be uploaded to the forum hosting).

## Calculate Volume Based On Criteria

Dec 22, 2007

Need a way of getting one of 4 values in sheet 2 to perform a calculation with. The aim is to show the total volume of a given item. Because there are four data sources for the actual volume (with varying degrees of accuracy) I've incorporated all of them in one sheet but want to use the values in precedence i.e. the first figure is where I've had someone physically tell me how many fit to a pallet (cubic metre) and know that to be accurate. If the value there is 0 I want to use the next figure as certain other items were measured physically. Column three and four are from some legacy systems and therefore should only be considered if the figures are 0 in the first two columns. Rather than ramble on any more I've attached a sample sheet

## Calculate Formula Based On Cell Criteria

Aug 30, 2006

I only want the formula to operate when there are values to calculate and then ONLY refer back to the last calculation. If there are gaps between the calculations I would like those to remain blank. Is that possible?
I have attached an example of what I am trying to do.

## Calculate Median For Multiple Non-Sequential Columns Based On Criteria

Sep 27, 2012

I have long series of data in 8 columns (B, F, J, N, R, V, Z, AD) starting at row 5 down to row 86404. I want to find the total median for each row, where a condition is met for that row. The condition is if number>10 and the number is located in row 3 for each column (i.e., B3 for column B). So, if B3, J3, R3 are all >10, then I want to find the median for all the numbers in the columns B,J,R.

I assume there is an array formula that could do this? I've tried a few solutions with no luck.

## Create Database Table From Multi-Column Summary Table

Nov 5, 2008

I want to accomplish something like this but slightly different:

[url]

I have the same issue but a bit more complex. In my case I have an additional amount of columns (let's say dimensions). So for the example given (sales per month) I would add two columns for 4 different regions and 5 machine types (just examples).

The output (that would serve as pivot tabel input) would then have to be a 4 x 5 x 12 x 4 = 960 row database table.

I have tried to accomplish it by customizing the given code but that provedto be beyond my powers ;o)

and some 3rd party software [url]and [url] but non of them is doing what I'm looking for.

The code I'm looking for ideally would count the number of columns and unique records per column and construct the database table from that. So I am looking for flexibility in the number of dimensions also...

## Macro To Extract Variable Info From Data Set And Calculate Corresponding Values

Nov 16, 2009

I have a small data set (ends up with 8 columns, up to 1000 rows), that gets imported sorted and formated via a macro linked to a button. I need to be able to look at one particular column of info, which will contain different text values every time the data is updated, and create a list of all the different values that occur in that column (maybe 10 max). Then...... I need to calculate a numerical value from adjascent column, linked to the text values from the first process. Below is an example to better explain:............