Cell Reference from another worksheet

Ankitsahgal

New Member
Joined
Dec 19, 2015
Messages
11
Hi All,

I have in sheet1 , the following data

Employee Number
Name
Basic SalaryOvertimeLieuBonus
3Smith, John£200£10£0£0
64Porter, Helen£210£0£35£0
38Rayne, Alex£300£0£0£50

<colgroup><col><col><col><col><col span="2"></colgroup><tbody>
</tbody>


I want to summarize the above information in Sheet2 in the following format:

GL CodeDescriptionAmount
2000
Smith, John Basic Salary£200
3000Smith, John Overtime£10
2000Smith, John Lieu£0
3500Smith, John Bonus£0
2000Porter, Helen Basic Salary£210
3000Porter, Helen Overtime£0
2000Porter, Helen Lieu£35
3500Porter, Helen Bonus£0

<colgroup><col><col><col></colgroup><tbody>
</tbody>


















The actual data has a lot more information (Overtime1, overtime2,etc) and also a lot more employees.

I have tried to use Cell and Indirect function for reference but I am unable to get the desired result.

Can someone please help

Thank you

Ankit
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
In Sheet2!$C$2 (the Amount Column)


=VLOOKUP(LEFT(SUBSTITUTE(B2," ","-",2),FIND("-",SUBSTITUTE(B2," ","-",2),1)-1),Sheet1!$B$2:$F$4,MATCH(RIGHT(B2,LEN(B2)-LEN(LEFT(SUBSTITUTE(B2," ","-",2),FIND("-",SUBSTITUTE(B2," ","-",2),1)-1))-1),Sheet1!$A$1:$F$1,0)-1,FALSE)


Change the blue bit to include everything from the Name column to the end of the table on sheet1 for all rows (excluding the header)
So if you have 50 employees for example and 10 columns of data (with the name of employee being in the second column)
It would be Sheet1!$B$2:$J$51 just as an example. Dont forget the $ symbols

Change the red bit to include all headers to the table on Sheet 1
with the above example (10 columns of data on sheet 1) this section will become
Sheet1!$A$1:$J$1 Don't forget the $ symbols


This is assuming that your actual data on Sheet 2 in column A would be in the format exactly as you have provided

lastname, firstname category (seperated by spaces)


Once you make the adjustments, copy down.
 
Last edited:
Upvote 0
=IFERROR(VLOOKUP(LEFT(SUBSTITUTE(B2," ","-",2),FIND("-",SUBSTITUTE(B2," ","-",2),1)-1),Sheet1!$B$2:$F$4,MATCH(RIGHT(B2,LEN(B2)-LEN(LEFT(SUBSTITUTE(B2," ","-",2),FIND("-",SUBSTITUTE(B2," ","-",2),1)-1))-1),Sheet1!$A$1:$F$1,0)-1,FALSE),"")

Would change the #values to blank cells...
 
Upvote 0
Thank you tygrrboi. This seems to work absolutely perfect.

However, my sheet is set up in the below format

GL Code
DescriptionAmountEmployee NumberCategory
Employee Name
2000Smith, John Basic Salary£2003Basic SalarySmith, John
3000Smith, John Overtime£10OvertimeSmith, John
2000Smith, John Lieu£0Lieu TimeSmith, John
3500Smith, John Bonus£0BonusSmith, John
2000Porter, Helen Basic Salary£21064Basic SalaryPorter, Helen
3000Porter, Helen Overtime£0OvertimePorter, Helen
2000Porter, Helen Lieu£35Lieu TimePorter, Helen
3500Porter, Helen Bonus£0BonusPorter, Helen

<tbody>
</tbody>

I have everything being populated automatically when the employee number is correct. However, I am unable to automate it i.e, I need to manually enter the next employee number as, if I reference first employee cell and add one, it gives me the value 4, as opposed to 64 ( which is the next employee number)

Thank you for your response.

Ankit
 
Upvote 0
Do you want the employee number to be added automatically when you input the Description?

I am confused by what exactly you want to accomplish.

Do you just want to have an equation in Sheet 2 Employee Numbers column that repeats every four cells? copying the table from Sheet1?
if so:

in Sheet2!$D$2 =INDIRECT("Sheet1!" & ADDRESS(1+(CEILING(ROW()-1,4)/4), 1,4))
 
Upvote 0
Thank you Tygrrboi. That is exactly what I needed. :)

All my other fields in sheet 2 (GL code, amount, description, etc) are being populated based on employee number.

How would I replicate the formula if the Employee name repeated every 52 cells ?
 
Upvote 0
You mean to say apart from Salary, Overtime, Bonus, Lieu... There are a total of 52 columns after Employee Name in sheet1?

in Sheet2!$D$2 =INDIRECT("Sheet1!" & ADDRESS(1+(CEILING(ROW()-1,4)/4), 1,4))

replace the red numbers with the number of columns you have.

Dont change the blue 4. This designates the address as not absolute. (it makes it A1 instead of $A$1)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,093
Messages
6,123,069
Members
449,090
Latest member
fragment

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top