Solved

Excel 2010 'renumbering' forumla values on linked worksheets

Posted on 2011-09-09
9
325 Views
Last Modified: 2012-05-12
Hi All -

I have a pretty basic workflow going on that I'm having issues with.

I have a database with values. These values are then pulled into an excel doc on a worksheet. Nothing formatted there - just a pure 'data' worksheet. Then I have another worksheet where I map in the =VALUE(Data!AC3)... in to the appropriate field. Well I have a bunch of these so I just drag the formula around so each cell is sequential in the formula. It works great. I can refresh it and it refreshes...

UNTIL

A new row is added to the source data.

Whenever this happens, the sequence on the formulas skips a number, so instead of going from =VALUE(Data!AC3) to =VALUE(Data!AC4) in the next cell it goes =VALUE(Data!AC3) to =VALUE(Data!AC5)

I have no clue how to fix this as I've never seen it happen before.

Any ideas why??? Any ideas on how to fix it??

It's Excel 2010 and MS SQL Server 2008 R2 RTM.

Thanks in advance!
0
Comment
Question by:rmm2001
  • 5
  • 4
9 Comments
 
LVL 32

Expert Comment

by:Rob Henson
ID: 36511909
Try this instead:

=VALUE(INDIRECT("Data!AC" & ROW())

This assumes that row 1 of data sheet goes to row 1 of other sheet. If not put +n between the last brackets with n being the number of rows that they are different.

Thanks
Rob H
0
 
LVL 7

Author Comment

by:rmm2001
ID: 36511929
Hmm I've never used INDIRECT before (although I've seen it posted online in places). Do I need to reference my cell number when i do the "Data!AC"?

The row numbers don't match up. So Data!AC5 would match up to [other worksheet]!BH789

Would that be  =VALUE(INDIRECT("Data!AC" & ROW()+784)?

Thanks!
0
 
LVL 32

Expert Comment

by:Rob Henson
ID: 36512001
Sorry, in that case it should be -n so for your example it would be:

=VALUE(INDIRECT("Data!AC"&ROW()-784))

or

=VALUE(INDIRECT("Data!AC"&ROW(BH5))

To expand on the original question:

Why is it happening? in your example, Contents of Data!AC5 are linked to OtherSheet!BH789. New data is inserted into the data sheet by inserting rows. Excel has a link to row 5 but row 5 has just been pushed down to row 6 by inserting a row above it, therefore the link moves.

How does INDIRECT work?  A simple formula of =A1 will return the contents of A1. Whereas =INDIRECT(A1) will look at the text contents of A1 and evaluate the contents as a cell address and return the contents of that cell instead. If the text contents do not evaluate to a cell address it will return an error.

So the formula above is forcing the "Data!AC" part of the cell address as a text string and then ROW() returns the row number of the cell reference within the brackets or if blank the row of the cell in which it is placed. Thus completing the cell reference.

Thanks
Rob H
Rob H
0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 7

Author Comment

by:rmm2001
ID: 36512044
Oh wow that makes so much sense! Thank you for explaining that.

I have a row like this:

=VALUE(SUM('Data'!H2:I2))

How would I convert that to using the INDIRECT? (Or does it need to be two steps)
0
 
LVL 32

Expert Comment

by:Rob Henson
ID: 36512045
This approach is somewhat volatile as it relies on the structure of the 'OtherSheet' remaining static.

Is there any other reference that could be used to identify the relevant row from the source data, eg lookup on another column.

Thanks
Rob H
0
 
LVL 7

Author Comment

by:rmm2001
ID: 36512089
The other sheet will be static - it's just a linked table in from SQL server. There's really no lookups - just the two fields there that need summed. Would putting them in their own field on the "OtherSheet" be the best approach?
0
 
LVL 32

Expert Comment

by:Rob Henson
ID: 36512093
I assume it would be the 2 in the formula that might change.

=VALUE(SUM(INDIRECT("Data!H"&ROW()&":I"&ROW())

With the adjuster after the ROW() if so required.

Thanks
Rob H
0
 
LVL 32

Accepted Solution

by:
Rob Henson earned 500 total points
ID: 36512125
Easiest way to develop the formula like this would be:

1) create the formula as it should be

=SUM(H2:I2)

2) Convert the range reference to text

=SUM(INDIRECT("H2:I2"))

3) Replace parts of the formula within the text with formulae that equate to text or numbers depending on part using " " around hard coded text strings and the & as a joiner to keep the text string intact.

=SUM(INDIRECT("H"&ROW()&":I"&ROW()))

The creation of the text string can be done in a separate cell and then copied in if so required.

Thanks
Rob H
0
 
LVL 7

Author Comment

by:rmm2001
ID: 36512147
Oh wow - thank you so much! This makes a lot of sense!
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question