skip if statement is false in excel mac - excel

I am currently working on a database (that's why I needed to blur some cells.) and I want to copy some data from the first sheet according to the graduation status. We are planning to use this database for next years too, so I want it to copy the data automatically when someone adds information. I wrote a formula for this, it is copying the data as I want but it cant skip the false condition; as it can be seen, the 8-9-16-17th row in General Sheet is copied to Student Sheet.
I saw another problem like mine and tried to implement the formula in my sheet but I couldn't make it work.
The problem that another person was dealing with: Get cell value but skip row if wrong
The formula I found and tried to implement in my Excel book: =IFERROR(SMALL(IF(($B$2:$B$15="Denied"),$A$2:$A$15,""),ROW()-2),"")
The formula I used in my Excel book: =IF(GENERAL!E3 = "Student";Table1[#Name];"")

With Excel 365 you can use the Filter() function. In the sreenshot I used
=FILTER(A:C,B:B="student")
Be aware, though, that with any formula solution, the result will be dynamically recalculated, so if you are planning on adding any data to the filtered table, these manual data entries will become a problem when the formula updates and the previous results occupy different positions.
If your goal is to get a one-time copy of all the non-graduated Students in Sheet A, you could just sort the sheet by the status column and copy/paste the desired data into a new sheet. That pasted data will not change and you can make manual edits.

Related

Copying rows from one sheet to another - checking previously copied data and inserting data above row that says "Subtotal" in column G

A bit of background before I start. Essentially, I've got all workers to fill out a form of their 'whereabouts' and what work they did, this then automatically populates into the correct fields etc. Using Power Automate, however, this is in table format and will literally update a a type of master.
My answer to this has been to just pull every cell from the Master table (e.g =A1 of x sheet) that my Power Automate flow creates and just bring it onto a centralised spreadsheet. Then from my forms submission there is a unique reference for form submission in cell G on every row, which will be the time and date they submit their response.
My data all has formulas in (as explained above), therefore the last row will be pretty difficult to find as I can't just find the last row as I usually would - so this would usually just go to the last cell where there aren't formulas, right?
How would I be able to find the correct rows to copy over?
Ideally, I would check to see the values value in column G that appears in any other sheet, if they do, do not copy. If they don't then copy over and insert rows above the cell which contains the text 'Sub Total'
Not sure if I've just fully confused myself and it's super easy but I just can't figure it out and even get started on it.
I am struggling to even think of a solution, apologies.

Making excel search using one letter in cell

So basically, I have been trying to make excel scan one column and print out the row for cells which have specific letters.
For example I have the following data in my sheet.
What is required is to be have excel search for the values which contain T and I, and then print the new rows. Kind of like separate the two into two different tables, because then so that I can do further analysis on them.
So far I have been trying to use the VLOOKUP() function, but the problem with VLOOKUP() is that excel required a proper match and not just a letter in the cell. I had tried with both FALSE and TRUE. Then instead I tried to use the =INDEX($B$4:$K$9;MATCH($A$17;$A$5:$A$9;0);COLUMN(A4)) to make it work. But that also does not work, since it also requires a full match. Also another problem which I didn't realise before is that how can excel recognise each cell, because I will have different number after the letters everytime and then so how can one make excel not repeat the same row twice?
I have used another approach where I copy the data in a separated sheet and then I simply filter out the Ts and then copy/paste the Is into another sheet and vice versa. it is time consuming and so it would be much better if I can simply copy/paste my new data and it would generate the division on its own.
any suggestions or link would be really helpful.
UPDATE
I had a new idea on how to approach this problem. I was thinking that is it somehow possible to have VBA code running for filtering the data. Is there a way to specify in VBA code to filter the data by "Starts With" and Make the results be printed in another cell block?
Looks simple enough. First step is to make sure you have headers over your data and that it is in proper table format similar to my picture. Then select Data set and press CTRL+T. That should turn you data in to table object with stripes. Use the Formula =LEFT(C2,1) to take out the first letter which will be L or T.
Select the table and press ALT+D+P which will generate a pivot table based off original data set.
Drag the column with the formula I suggested over to the FILTERS area of the pivot table ID column to ROWS and all others to VALUES. Simply refresh and as new data is added you will get new pivot tables. Do not put the pivot tables on top of each other as I did that is only for the picture so you can see it. If you have too many filters to apply you can right click the helper column in the pivot table fields area to produce a slicer which is a button that helps you change the report quickly. Any other questions do ask.

Copy & Paste From Different Workbooks to MasterSheet

I have one workbook with 8 sheets per country (i.e. France, Belgium, etc.). Apart from these sheets I have "Mastertab" and "Database".
Country-sheets are created in the same way (they have the same template). These templates are made to track expenses (therefore for example, France may have 10 expenses, Belgium 3 and UK 81).
What I would like to do is to create a macro (because I think it is impossible with formula if I want to avoid blank rows) that will:
Find last row where is any data/value in column K.
Select all data (row that will be indicated in point 1 and columns B-P).
Paste this selection to the Mastertab.
Continue doing 1-3 for other countries/sheets KNOWING that data should be pasted just below the previous one (so it has to find first blank row and paste data there).
Example:
First row with data for each country is 18. This is the place where first line with expense is posted. User will fill in only data in column K (all other columns are filled with formulas, vlookups, etc.)
Assuming that I have 3 expenses for France, I want Excel to select B18:P20 and paste into Mastersheet in cell B18.*
*Next pasting in Mastersheet should be from cell B21.
Hope it is clear. :)
Thank you in advance,
Marek
you would definitely be stretching the limitations of Excel formulas if you tried using formulas to do this.
You can use VBA to do this, but you're going to probably going to need the user to trigger the macro every time they make an entry. If you need the master to be dynamically updated then that's going to be harder again.
I think the cleanest way to do this is to have a macro that builds the master list from scratch every time you run the macro, i.e. deletes the Master sheet, and recreates it again. This way you don't have to deal with reorganizing the master output every time a new row is added. That would require a lot of additional logic.
If you are doing a multi-user environment with concurrent updates, then this approach will not work, as you would need an additional server to handle messaging between each user. At this point, you're better off not using Excel.
If each user will add their data, run the macro and send the sheet to the next user you could concoct a macro approach.
From a very high level:
Create a macro to co-ordinate all that comes below
Delete everything in your master (MasterSheetName.Cells.ClearContents will keep the formats if you need it)
Create an index which keeps track of the last row with data in your master sheet. This will start at 1
Iterate through each of the country sheets
https://support.microsoft.com/en-ie/help/142126/macro-to-loop-through-all-worksheets-in-a-workbook
Iterate through column K looking for values
Iterating through populated rows in Excel using VBA
In this example they are looking at column A. You can replace 1 in the sh.Cells(row,1) to sh.Cells(row,11)
Copy the data to the mastertab
Copy from one workbook and paste into another

Use VLOOKUP but detach the value from the lookup once it is in the cell/looked up

I have the following:
1 Access file with a big list of items that people can order.
1 Excel file with 2 tabs.
In the 2nd tab of the Excel file I import the Access table.
For each row I have a dropdown list in the first column with the values of the first column of the access table.
In the 2nd column of the first tab I use VLOOKUP to show the price linked to the item of the first column.
In the 3rd column of the first tab the user can fill in an amount.
Here's the catch:
in the 4th column of the first Excel Tab I want to show a total so B * C. Nothing hard about that. But I want this value to NEVER CHANGE.
So even if the Access database is updated I do not want the value of the already calculated cells of column 4 to change.
I know it seems pretty unlogical but I really need this.
Any suggestions? Is there a formula that I am missing?
EDIT from post:
The file is to be used be other people than myself. If paste special can be done automatically as in like a formula it would help but that doens't exist or I haven't found it.
Thanks in advance.
If the formula is linked to a connection (e.g. OLAP cube, a table that is linked to an Access table) then remove the connection before sending the sheet out. See link.
If you distribute the workbooks to people who do not have access to the data itself (not on your network) the issue will solve itself, take away that some dummies will complain about their data disappearing not refreshing.
The formula you're asking for would refer to itself once it has a value, confer circular reference.
If used by your close enivronment you might want to have a VBA snipplet insert your formula and then do the PasteSpecial method automatically (you'll have to enable macros on each of the computers involved in this case).

How do I get my formula to always reference to the last sheet?

I currently have 2 worksheets in my excel file.
The first sheet is known as the Summary page, which displays an summary result of the second sheet.
The second sheet is known as the raw data. An example would be a column named Fruits.
Apple
Apple
Apple
Banana
Banana
Pear
In the first sheet, I would have a formula that counts the number of time the respective fruits appear and the result will be displayed in different cells.
=COUNTIF(Fruits!A2:A7,"Apple")
=COUNTIF(Fruits!A2:A7,"Banana")
What I wanna do is, is it possible for me to program the formula such that everytime I add a new sheet of raw data (3rd sheet), the statistics on the first sheet is able to reference to the latest sheet to get the information.
(Assuming that the positioning of the data and all are the same as the second sheet.)
What I have done so far is to come out with a function GETLASTWSNAME() which is able to always retrieve the name of the last worksheet. but it seems kinda impossible for me to nest the function within the countif formula itself.
=COUNTIF((GETLASTWSNAME())!A2:A7,"Apple)
The above formula is how i want my formula to work, but sadly excel does not allow me to do that.
Any comments would be appreciated. Thanks!
You can use the XLM/Range Name workaround for this and not VBA if you prefer
Define a range name, wshNames to hold the array of sheet names
=RIGHT(GET.WORKBOOK(1),LEN(GET.WORKBOOK(1))-FIND("]",GET.WORKBOOK(1)))
Uses David Hager's technique
Use this Excel formula to extract the last sheet name from the array of sheet names
=INDEX(wshNames,COUNTA(wshNames)+RAND()*0)
This formula says look at all the sheets, then return the last (using the COUNTA). The RAND()*0) portion ensures that the formula is volatile and updates when Excel does
If you do use VBA you will need to ensure your GETLASTWSNAME function is volatile, i.e. it gets updated when changes occur.
=COUNTIF(INDIRECT(GETLASTWSNAME() & "!A2:A7"),"Apple")
In Excel with spill function and the new Sequence() you can list all your sheet names with the same technique just from one cell! First to last or last to first, your choice. With Transpose you get a column header for each sheet (Obs volatile).
After defining the named formula wshNames as told by Tomalak ( thanks for the tip ) I used:
=INDEX(wshNames;COUNTA(wshNames)+1-SEQUENCE(COUNTA(wshNames);1;COUNTA(wshNames);-1))
my Excel is using ";" as a separator, you may have to change the semicolons with a comma
Rolf H

Resources