# Calculating Sum Of Relative Cells

Feb 19, 2009

I work with Excel the more I realize that I'm not that good at it Anyways, I'm in need of a quite advanced formula (for me) that sums up relative relative rows of a specified column. The rows relation depends on the ID-number of the person. Look at my attachment.

In Sheet1 I have an extract of the data I'm working with. It's a medical record of different people in a study. The ID (col. B) seperate the different people. One person can have several perscriptions (spelling?) of medicine. Every perscription has an "fddd", a daily dose (col. L). I want to add up all the daily doses for every seperate ID of my data in Sheet2. So for example, for ID1 I want it to sum L3:L6 in Sheet1 and return it to Sheet2!B2. If the ID is not found I want it to be blank.

## Turning On Relative Cells

Feb 3, 2010

I have this formula:
=IF('2010'!R10C2="y",'2010'!R10C3,"")

And I want to be able to drag it down and have the cells update, but all it does is keep the same values.

Is there something I need to turn on or off.

## Relative, Absolute & Mixed References In Many Cells

Jun 17, 2006

mixed references across several cells however these solutions seem to result
in formula with all relative or all absolute or all mixed.

I need to change the formula in lots of cells with a mix of types of
reference. e.g. I need to change "\$E\$4*AD\$2" to "\$E4*\$AD\$2" & would prefer
not to have to go though each of the cells with F4!

## Use Range Of Selected Cells As Relative Reference

Mar 8, 2013

I have a data that is split into multiple cells and needs to concatenated. Unfortunately, the number of columns wherein lies the data varies throughout the workbook. As such, I wanted to select a range of cells, define this range as the reference point for the macro, run the macro, then move on (selecting a different number of columns on the next try).

For example, I have this:

A
B
C
D
E

1

No
Not Very Far

[Code] .....

I want to select cells A1:B1, run a macro concatenated the two columns, then select cells C1:E and run the same macro to get this:

A
B

1
No
Not Very Far

[Code] ........

So far, I have this:

Code:
ActiveCell.Columns("A:A").EntireColumn.Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
ActiveCell.Offset(5, 0).Range("A1").Select
ActiveCell.FormulaR1C1 = "=CONCATENATE(RC[1],RC[2])" '

## Reference Cells Relative To Activecell In A Range

Nov 4, 2008

I've been trying to get the sum of a range of cells based on their relation to the active cell. Here is the Pseudo
If the SUM of (the cell 2 rows up THROUGH the cell 2 rows up and 2 columns to the left) = 0 then .......

*****end pseudo

I think that activecell.offset is the best way to do it, but I can't figure out how to work that in a range....

Here is my code so far:

Worksheets("Generic SPC").Activate
Worksheets("Generic SPC").Range("c2").Select

'Do for all cells in the row
Do

ActiveCell.Offset(0, 1).Select
If Application.WorksheetFunction.Sum(Range( _
ActiveCell.Offset(-2, 0), ActiveCell.Offset(-2, 2))) = 0 Then
ActiveCell.Value = 0
ElseIf Application.WorksheetFunction.Sum(Range _
("ActiveCell.Offset(-2, 1), ActiveCell.Offset(-2, 3)")) = 0 Then
ActiveCell.Value = ActiveCell.Offset(-2, 0).Value
Else: ActiveCell.Value = 0
End If

Loop Until IsEmpty(ActiveCell.Offset(0, 1)) = True

******End Code

Range doesn't like activecell.offset. Does anyone know how to do this?

## Find All Occurrences Of Value & Copy Relative Cells

Sep 22, 2007

The code is supposed to find HEQL in column G in BOOKED.XLS ( attached) and then do a series of copy pastes into two other workbooks. For some reason, it is only finding one instance of HEQL and there should be 255.

Sub COF1()

Dim lastrow As Long
Dim x As Long

Windows("COF_OUPUT.xls").Activate
Worksheets("Sheet1"). Range("B:B").NumberFormat = "0.0000000000000000"
Windows("BOOKED.xls").Activate

Range("A65536") = "100"
Range("A65536").Copy
Range("F2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlDivide, SkipBlanks _
:=False, Transpose:=False
Range("A65536").ClearContents
Range("A1").Select .....................

## Return Cells Relative Position In A Category

Aug 1, 2008

I've got a list of story titles that are organized by genre, and I'd ultimately like to have a formula (not VBA) that automatically generates a "story id" based on the title's position within the genre (not the list overall). Here's a snippet of the list:

CREATE TABLES LIKE BELOW?IDGenreTitle
1.1GeneralTitle 1
1.2GeneralTitle 2
2.1Horror / SupernaturalTitle 3
2.2Horror / SupernaturalTitle 4
3.1Sci-FiTitle 5
3.2Sci-FiTitle 6

So what I'm looking for here is the formula that would give me the ID shown in the first column (I can modify it later for specific purposes). I've tried variations on the MATCH, INDEX, ROW, and VLOOKUP functions but just can't seem to get it quite right. Note: All the items in the Title column are unique - there are no duplicates.

## Count All Cells Containing Certain Text Value By Row Date Relative To Today?

Mar 11, 2014

I want to use a sheet for planning work tasks. I need to count how many cells containing 'x' text exist in rows starting with dates greater than or less than 'Today'

If you look at my workbook (attached) I have dates and tasks on 'sheet1' I have stats on 'sheet2' In the 'spent' on sheet2 I have a COUNTIFS to count the cells containing 'Fish' but I also want to narrow it down further so that I see the nuber of cells containing 'fish' where the date in the A column for that row is less than 'Today'

## Macro To Find Duplicates And Consolidate Certain Relative Cells?

Feb 5, 2014

I am currently working on a project where i am given a sheet that typically has several hundred rows of data and not seemingly organized in any manner. This document has 6 columns, and my main focus is a range of dates (in MMM-YYYY form) from around early 2000 to now that can have duplicates. The dates(Column C), have corresponding Usages (Column D), and Costs (Column F) and I need to add these values together and remove the duplicate months so I only have one Usage and one cost Per month.

My spreadsheet has 6 Columns of data, and varying number of rows. Currently, since I receive the numbers in an unorganized fashion, my macro organizes the data into a table and then sorts the table be date so I have the oldest dates first and the duplicates are adjacent. There may be varying numbers of duplicates, though typically 0 to 4.

## Selecting A Range Of Cells Relative To The Current Cell

Oct 31, 2006

I would like to select a range of cells relative to the current cell and move them to the right two cells. Basically, if I were in cell A1 I want to be able to have a macro select A1 - A8 and move them over by two cells leaving A1 and A2 blank.

Excel 2003

## Color Row Based On Fixed Cell & Relative Cells

Apr 15, 2008

My sales spreadsheets have a column which is turned to 100% when the order comes in (i.e. when the salesman gets it in his commission). I have applied conditional formatting to turn the whole row green when this happens (for ease of seeing which orders are in)

We also have a cell for the Purchase Order "number" (as these come from the customer, these can be a straight number sequence - "12345" or a mix of letters and numbers - "ABC12345"). My boss would like this cell to be red if the "order in" column is at 100%, but there is no PO number.

However, when I put in the formatting:
(1) =\$K\$15=1 (to turn the row green)
(2) Cell Value is equal to 0 (to turn the cell red)

it will apply (1) no problem, but will only apply (2) if (1) is false. (i.e. if (1) is true, the whole row goes green, with no red in the PO box.)

If I switch them round (i.e. have (2) first), then I get the formatting that I want (i.e. green row with a red box), but if (1) is false, I still get a red PO box.

What I need is a way of only applying (2) if (1) is true. (or any other way of only making the PO box red if the order is 100% but there is no PO number)

## Find Specific Value In Array Which Appears Multiple Times And Average All Relative Cells

Jan 24, 2014

I'd like to search for a specific value like (1) in an array of cells like (A:A). The result needs to be the average number of a different column (B:B) in the same row as the searched value (1). And the resulting number should be rounded up to the nearest 10.

Example below: (Find value = 1 in A:A) ... 1 is found 4 times.

A | B
1 | 295
3 | 123
1 | 400
5 | 425
1 | 354
1 | 400

In the example above there are 4 (1's) found. By adding all the values in column (B) of the same row, we get 295+400+354+400 = 1449, dividing that in 4, the average is 362.25, rounding that up to the nearest 10... THE RESULT I'M LOOKING FOR IS: 370

## Calculating Sum Of Cells Only Where Adjacent Cells Are Blank

Oct 17, 2008

Code:.....

I am constantly editing this (we currently have over 100 accounts) and therefore the totals are changing.I have a formula for Total but I need formulas for the other two, based on when the cells in columns F and J are blank or have dates in them: For active, the total is the sum of all numbers in column M but only when there is a date in column F and a BLANK in column J. For yet to enter, the total is the sum of all the numbers in column M but only when both column F and column J are blank. At the moment, my accounts run from row 6 to row 142, with the first line of totals in row 145, however this is constantly expanding.

## Calculating Cells Used Based On Another Cells Data

Mar 6, 2008

I have a bit of an odd issue I need to solve. I use an Excel spreadsheet to track daily income for the store over a months' period. I have each day set to give me a rough estimate of profitability for that day. I also want to create a cell that tells me how much we've made so far, based on the number of business days so far in the current month. For example:

Day 1, \$1500, \$800 in expenses (monthly expenses averaged over the month, plus labor costs for the day), so a total of \$700 profit.

Day 2, \$1700, \$749 in expenses (same as before), so a total of \$951 profit.

The formula I'm using to calculate that isn't an issue, but I have the same formula for every single day, and each day has it's own cell with the estimated profitability for that particular day. In two other cells, I put the total number of business days in that month (in this case, 26), and in another cell I put the current number of business days we've had this month (in this case, 4), which is used partially to calculate the other cells. I want to use them to create another cell to contain the estimated profitability based solely on the number of business days out of the month we've had.

So E3 through E33 contain the individual days, I want to calculate - since we've only had 4 business days - what E3 through E7 would total. When I change it to 5 business days, i want it to calculate E3 through E8. So if we've had 4 business days, it only calculates the totals from the first 4 cells, if 5 business days, then the first 5 cells, etc, etc.

I can sort of picture it in my head, but I can't seem to find the necessary equation for it. It may require a macro, but I'd rather use a formula if possible. I'm not a big fan of macros.

## Cells Not Calculating?

Nov 9, 2008

I am having a problem with some of the cells in a spreadsheet not calculating.

For example, in column A, all the cells have formulas that pull data from another sheet. When I enter the formula, only the formula shows (not the result). I can't figure out what is wrong as the formulas in column B work fine (the results are showing, but not using the same data that column A is).

I am thinking it may have something to do with the data being used to calculate the formulas but not sure. How can I resolve this?

## Calculating Cells ..

Apr 1, 2009

I have the workbook set to Auto Calc the Cells, which seems to be a bad idea, because with the amount of formula in the workbook, it slows the whole thing down and makes it impossible to do anything within it.

Is there a way that I can speed this process up, using some code when I run certain sections?

There is a copy of what I am doing, so you can see the amount of formula.

## Calculating Non-Numeric Cells

Nov 11, 2008

I need to find the number of cells containing a specific word. Here's an example:

Site # Visit
1001 12-Aug-2008
1001 LATE
1002 08-Jul-2008
1003 09-Aug-2008
1004 LATE
1005 12-Aug-2008
1005 LATE

I need a formula that will calculate how many "LATE" cells there are.

## Calculating A Sum On Non Adjacent Cells Across A Row

Jun 17, 2009

See the attatched spreadsheet. I can not seem to figure out a formula that will calculate the totals for each type of data.

My goal is to have a sum for each location for # of audits, Critical Counts, and Major Counts.

## Calculating Due Date From One Of Two Cells?

Mar 25, 2014

At the moment I have a simple formula that calculates the due date of a task

The log in date is in cell B3, I use a simple formula in cell F3 "=B3+20" - This gives me the due date

So now ....

Either B3 or D3 will contain a date - whichever one is populated I will need the due date displayed in cell F3

## Calculating If Diffrent Cells

May 19, 2008

I have a question maybe this isn't even possible or it is i'm not that high on excel calculations, but I would like to know this.

I have this document:
[url]

I would like to calculate that if i've rated a 5 (cell C) I would like excel to calculate the time (cell B), the thing is that I want to calculate how much time I've wasted watching movies in every rating 1-10.

## Calculating Cells For No Reason

Oct 21, 2008

If I enter anything in a cell on one work book I get calculating cell for about 3-5 seconds.

I don't have any formulas looking at the book. and I have deleted, renames, copy and pasted, exported to text and reimported and still it does it.

The thing that is odd though is that if I press return again it clears the calulation cells message.

## Calculating Ratios With Zeros In Some Cells?

Jun 30, 2014

I am calculating ratios to show as 1:0 or 3:2 etc using this formula: =IFERROR(CONCATENATE((K2/GCD(K2,N2)),":",((N2/GCD(K2,N2)))),"Nil")... I have a lot of columns that have zeros in them and the formula i am using doesn't seem to work for those...

Example

A B
3 6 should equal: 1:2 works OK
2 0 should equal: 2:0 my current result: 1:0
3 0 should equal: 3:0 my current result: 1:0
0 1 should equal: 0:1 works OK
0 0 should equal: Nil works OK
4 1 should equal: 4:1 works OK

Anything with a zero in the first column comes up as 1:0

## Calculating Percentage Difference Between Cells

Dec 5, 2013

Formula "(Cell-Cell)/ABS(Cell)"

When calculating percentage difference do I always subtract the smaller number/cell from the larger number/cell, then divide by the smaller number/cell or vice versa? Maybe I am over thinking it, but it is confusing the heck out of me

I provided an example below to illustrate a spreadsheet I work on. The numbers go up and down. I want to know how I should go about setting up the formula. If I need to ensure the smaller number is always subtracted from the bigger number, it will require a lot of manual intervention on my part.

Row 3 is =(b2-b1)/ABS(b1)Row 4 is =(b2-b1)/ABS(b2)Row 5 is custom. I went through each cell and made sure the smaller number was being subtracted from the larger number, then divided by the smaller number

PercDiffExample.xlsx

## Calculating A Total Of Different Cells With Less Or More Values

Jan 23, 2014

I'm trying to calculate total occurrences of a given month. I have included the spreadsheet for reference with totals.

I only want to calculate when the Policy column has a "N". If it has a "Y" I do not need to do anything

If the Policy has a "N" I want the formula to look at the V and P columns and give me a total in the Total Occurrence column. I want it to look at the entire month for a grand total.

If the V or P column has a 4 or less it should equal 0.5, if it has a value is between 4 and 10 it would equal 1. So in the Total Occurrence column should calculate the all of the 0.5 and 1's based on each set of columns and give a total. In the example that I have given in the spreadsheet the total in the Total Occurrence column would be 2 because Jan. 1 has a N and a 8 which equals 1 and Jan. 3 has a N and a 4 which equals 0.5 and Jan. 5 has a N and a 4 which equals 0.5 for a total of 2 occurrences.

## Calculating Average Excluding Cells Containing <?

Jan 26, 2014

I am trying to calculate an average of 800 cells, where I would like to exclude a cell when a certain character is in it, namely "<".

## Calculating The Difference Between Cells, But Using The Value Of Another Cell If The

Jun 2, 2009

I have the following on a spreadsheet that keeps track of when student work is handed in and calculates how many days late it is so a penalty mark can be given.

A1= User entered value : a fixed submission date that a piece of work is due to be handed in on.
A2 = User entered value : The date entered if work is handed in on time or early
A3 = User entered value : The date the work was handed in if late
A4 = User entered value : The date the piece of work is due to be handed in if an extension has been granted
A5 = Calculated value : How many days late a piece of work is

Essentially I want the calculation in A5 to reflect how many days late a piece of work is. SUM(A3-A1) would do this of course. If the work is early or on time, A2 is ignored.

Sometimes however students have permission to hand work in late, in which case another calculation is needed to work out how many (if any) days over their extension date (A4) their work is. How do I combine these two calculations into the same cell, so that if A3 is empty it checks A4 to see if the student has an extension date and then returns a 'days late' value if applicable?

## Speed Up Or Eliminate Calculating Cells

Jul 29, 2008

I am using Arrays throughout a large report and each time I move around in the report or simply open the report I have to wait 5 to 10 seconds to wait for the cells to calculate. Is there a way to prevent this from happening other than changing the calculation option to manual.

Is this and array problem? I don't get this when I use multiple vlookups and choose formulas? Any ideas to speed up or prevent all together?

## Ignoring Cells While Calculating Average

Oct 18, 2009

I want to average the cells in column B but ignore values in the corresponding rows with a 1 or 7 in column C.

This will be used in a years data where 1 - 7 are days of the week and I want to separate weekdays from weekends when calculating an average.

## Takes Too Long ‘calculating Cells’

Aug 3, 2006

This code is taking way too long to display the actions that it executes. It didn’t used to be that way. I was wondering if anyone knows why this may be. The Excel file is large – over 8 MB.

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "N:N"
Dim Cmnt
On Error Goto ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If .Row > 3 Then
If Me.Cells(.Row, "N").Value = "" Or Me.Cells(.Row, "N").Value = "O" Or Me.Cells(.Row, "N").Value = "H" Then
Me.Cells(.Row, "A").Resize(, 26).Interior.ColorIndex = 0
End If
If Me.Cells(.Row, "N").Value = "C" And Me.Cells(.Row, "O").Value = "DR" Then
Me.Cells(.Row, "A").Resize(, 26).Interior.ColorIndex = 39
End If
If Me.Cells(.Row, "N").Value = "C" And Me.Cells(.Row, "O").Value = "HJB" Then
Me.Cells(.Row, "A").Resize(, 26).Interior.ColorIndex = 6
End If.....................................

## Gaps In Cells When Calculating Formulas

Jan 2, 2008

I have what is probably a simple problem for most, but can't figure out what to do.

In the sample sheet attached, I have times in column E, and an action describing what has happened in column G. What I want to do is calculate the length of time between an opening action and closing one, but don't know how to go about it, as there can be an empty cell(and sometimes more) between each open and close.