Issue with Cell value of different column after sorting - excel

I have a table in Excel with multiple rows. for example in cell A2 I have formula (=B3). The problem is if I sort the table. After sorting the row 3 moves to different row (example 5) but the formula remains the same = (=B3).
Is there a way so that even if I sort the table the formula gets the value from the proper cell in row?
this maybe simple but could not figure out. hope you can help.

You can prefix the sheet name. For example instead of "=B3" use "=Sheet1!B3", then the formula will not change after sorting.

Related

Filling every other row with the value of the following row

I'd like to fill every other row in an excel worksheet with the value that is following that row.
See example.
Is there a way to accomplish this?
I am sorry if this is an extremely easy task, but I just can't get my head around how this may work, since just plain copying the data, filtering for blank rows and pasting it into the filtered table just doesn't work as I want it to.
Thanks in advance.
Edit: It might be worth adding that I cannot at all change rows or columns in the excel sheet since it is connected to a database which configuration does not allow this.
Add a new helper column with the formula =ISEVEN(ROW()).
Filter this column on TRUE.
Select the range from A2 to the bottom-right of the cells that you want to populate, and input =A3 [Ctrl-Enter].
Clear the filter and delete the helper column.

Excel - returning the values from a range starting with the first non-blank value

I have a pivot table that shows the number of patients that collected medication in different months, grouped in columns according to month of first treatment.
To the right of the Pivot Table is another table where I want to show the columns from the Pivot Table side by side, with the first cell in each column being the first non-blank cell in that particular column. Put in a different way, I want to show the information in the Pivot Table but without the blank spaces above the first non-blank value in each column.
In the spreadsheet above, I have experimented with the following formula in the rightmost table:
=INDEX(B7:B20;MATCH(TRUE;INDEX(B7:B20<>"";0);0))
As you can see from the attached image, this formula does not give me what I'm looking for. It keeps returning the same first non-blank value in each column until it hits the row in the Pivot Table where that value shows up. Also, after going through all the cells, it keeps returning the cell in the last column of the Pivot Table over and over again.
Any ideas on how to correct this?
Based on your provided information, use this formula in cell M6 and then copy over and down:
=IF(ROWS(M$5:M5)>COUNT(B$6:B$19),"",INDEX(B$6:B$19,SMALL(INDEX((ROW(B$6:B$19)-5)*(ISNUMBER(B$6:B$19)),),COUNTBLANK(B$6:B$19)+ROWS(M$5:M5))))
And it looks like your regional argument delimiter is a semicolon instead of a comma, so here's the semicolon version:
=IF(ROWS(M$5:M5)>COUNT(B$6:B$19);"";INDEX(B$6:B$19;SMALL(INDEX((ROW(B$6:B$19)-5)*(ISNUMBER(B$6:B$19)););COUNTBLANK(B$6:B$19)+ROWS(M$5:M5))))
From what I understand you want to skip blanks. This formula should work for text and numbers in column B
=IFERROR(INDEX(B$7:B$30,SMALL(IF(1-(B$7:B$30=""),IF(1-(B$7:B$30=""),ROW(B$7:B$30)-ROW(B$7)+1)), ROWS($F$7:F7))),"")
Use CTRL+Shift+Enter when entering it, as it is an array-formula

Is there a formula that will paste the result of a separate formula as a value?

Ex.
column A is a formula that outputs an 8 digit ID from a prior delimited calculation. I want to vlookup that ID to a separate set of data, but it is not finding the ID when the lookup value is part of a formula.
Is there a way to paste the formula result as a value in column b?
I have a list of 3000+ IDs, so using the F2, F9 trick won't work, since I would have to do that cell by cell.
Would prefer not to use VBA, but if that is the only way, can someone help simplify that process (new to using VBA)
If you have data in column A based on a left function of a bunch of numbers, and just want that result in column B, all you have to do is put:
=Value(ColRow)
in Column B. Then you can look up the value in Column B via VLookUp.
I am an avid Excel user and personally tested this solution. Though it appears #Scott beat me to it in the comment section.

In Excel, how to verify that numbers from one cell in sheet 1, are the same with numbers in several columns in sheet 2?

I don't know what formula to use to verify that the numbers in one cell in sheet one are the same with numbers found in sheet 2 arranged in columns. I tried with vlookup but that works only if I search between cell to cell, rows to rows or columns to columns. Can i use a formula/several to find what data I am missing from one cell to several rows? Thanks
Use 
=(COUNTIF(E2:E100,A1)>0)+0
instead of
=VLOOKUP(A1,E2:E100,0)
where A1 houses the lookup value and E2:E100 is the first column of the lookup table of interest. Adjust the ranges to suit.
(source: http://www.mrexcel.com/forum/excel-questions/10000-how-compare-value-list-values-see-if-fir.html)
I think this could help you too: https://superuser.com/a/601421

Fill dates array and add dummy variables

I have a column with dates called "dates". This column contain dates from 01.01.2010 to 31.12.2010. it should have about 365 rows, but it actually has only 231 rows, because the data was not collected regularly. The others are missing, and I'd like to fill the gaps in time.
How can I fill the array of this column with the missing dates? I want to add 134 rows in the place of the missing ones, filling in the missing dates.
Create another sheet and put all the dates in column A in your new sheet.
Make sure your sheet with the data in it has the data column all the way on the left (important for how Vlookup works)
In your new sheet, starting in Cell B2 put numbers 1 through however many columns you have in your data sheet along that top row.
In your new sheet use Vlookup to find all the rows where there are data
=VLOOKUP($A2,DataSheet!$A$1:$C$20,B1,FALSE)
Note that the lookup column ($A1) is locked in to the column but not the row and that the range you are looking up is locked in in all directions. This will allow you to drag to the right/down and fill everything in.
Drag to the right then drag all the way down.
there will be #N/As where you cannot find a match which you can suppress with either an IF statement of conditional formatting. But now you have a row for every day with blanks when there is not data!
I found a solution with a similar formula, but the result was the same.
First, I got the two columns of data—"date" and "values" in the columns A and B of the worksheet. Each consisted of 231 rows. Then, I spread a full array of dates—365 in a new column D. Finally, I used this formula:
=VLOOKUP(D2;$A$2:$B$1056;2;FALSE)
in C2 and obtained the only the values from column "values" corresponded to the new dates of column D.
Thanks for Brad's answer for directing me to the VLOOKUP function.

Resources