How to include worksheet 3 and 4 in a cell formula provided?
- by user21255
I have been kindly given this formula with an explanation on how it works:
Insert this formula into the cell B4 of the sheet "Cases":
=IF(NOT(ISBLANK('1st'!B25)),'1st'!B25,IF(NOT(ISBLANK(INDIRECT("'2nd'!R" & (ROW($B4)-(COUNTA('1st'!$B:$B)-COUNTA('1st'!$B$1:$B$24))-4+25) & "C" & COLUMN(B4),FALSE))),INDIRECT("'2nd'!R" & (ROW($B4)-(COUNTA('1st'!$B:$B)-COUNTA('1st'!$B$1:$B$24))-4+25) & "C" & COLUMN(B4),FALSE),""))
Copy the formula to the other cells in the worksheet; the relative addresses will adjust automatically.
The formula works like this:
Check if there is content in 1st. If yes, copy it.
If no, find out how many entries there are in 1st in total. (This is done by using the COUNTA function on the whole B column in 1st and subtracting the number of non-empty cells above the actual case data.) Use this information together with the current cells's number to find out the location of the cell that has to be copied from 2nd.
Create the address of the cell and use the ISBLANK function on the INDIRECT function with that address to check if the cell is empty.
If it is not, use the INDIRECT function again to display it. If it is empty, just display an empty string.
Now this works fine when I have only 2 sheets. But lets say I want to include a third and fourth sheet (name as 3rd and 4th respectively), then what and should I put the formula for this in the formula above? There are actually 31 sheets but if I know how to add 3rd and 4th sheet in the formula, then I can figure out how to do the rest.
Thanks