How to mask accounts in excel sheet? - excel

Im working for a bank where customer accounts with varied lengths need to masked in excel sheet.
Is there any macro or formatting method which could help me doing this?
Eg:
Cell No Value:
A10 46579094628
A11 NL6539123747796621
This would turn to
A10 46XXXXXXX28
A11 NLXXXXXXXXXXXXXX21
I want to keep 1st 2 digits and last 2 or 3 digits intact. Please advise.

Who is going to be using this spreadsheet?
I ask because you can certainly create a new column with values computed by manipulating the text in the account-number column and you can get it to look exactly the way you want. But then you'll have to hide the original column. That may be inconvenient because:
Harder to maintain. Who/how are new accounts going to be added?
How do you know users won't just unhide the column? Seems like now you've got a password to manage.
Are you sure bank officials are ok with this?
Option two is to create the spreadsheet by manipulating account numbers from an export from a more secure DB so that they never make it into Excel. Then you don't have to worry about passwords, hidden cells, etc.

If you're looking for a way to create a separate column with the mask you can use the following:
=LEFT(<targetcell>,2)&REPT("X",LEN(<targetcell>)-4)&RIGHT(<targetcell>,2)
Just replace targetcell with the cell containing the account number.
I'd then copy the formula down for the full column; copy and paste the formula column "As Value" and delete the original account column to remove the sensitive information. (These steps could be entirely automated in VBA but this is an easy solution.)

Mask by
=right(sheet_org!a1a;2) & left("XXXXXXXXXXXXXXXX";len(sheet_org)-4) & left(sheet_org!a1,2)
if sharing without original content, copy and paste to new spreadsheet by macro.
or get external data in new workbook pointing at sheet with masked values.
regards,
//t

If your value is in cell A10 then insert the following formula in any blank cells
=LEFT(A10,2)&REPT("X", LEN(A10)-4)&RIGHT(A10, 2)

Related

Excel: IF ISBLANK Function Seeing 6 Additional Rows as Filled

The project I am working on has several components, so let me start from the beginning. From a calendar program, I am supposed to download a roster of individuals that have signed up for a course and input their names into a Sign-In Sheet. Later, once attendance has been verified, certificates are made for each person who showed up.
I have built a macro that takes the raw data from the calendar and builds the Sign-In Sheet around the list of names, alphabetizes, and formats everything as we need it with a click of a button.
The problem I am running into comes from the certificate portion of the process.
In order to speed up this part, we tried to create a second sheet behind the Sign-In sheet that would pull all the information needed on the Certificates into a separate list that could easily be mail merged into the certificate template.
Three columns in Sheet2 are user specific and change depending on raw data from the calendar. I got these cells to talk to Sheet1 just fine by using the =(Sheet1!A8) function, then copying is down.
However, the other three columns have to be filled from a single cell on Sheet1 that gets typed in after the macro is run (such as the date and location), so it has to be a dynamic link to Sheet1. In addition I need it to look at another range and stop filling in cells on Sheet2 when it encounters a blank cell, so we are not wasting time deleting unneeded information.
I got this working for the most part using =IF(ISBLANK(Sheet1!$A$8:$A$207), "", (Sheet1!$B$2)), but for some reason, the formula is filling 6 extra rows that are actually blank within the A8:A207 range in Sheet1. For example, Sheet1 A8:A207 contains data up to A25, however, Sheet2 is filling in cells as if Sheet1 is filled up to A31.
I have checked these cells for spaces and hidden formulas that could throw off my IF ISBLANK formula, but have not met with any success.
Does anyone have any idea what could be causing these 6 extra cells to fill and what I can do to fix it?
Many Thanks!
Is the formula you posted (=IF(ISBLANK(Sheet1!$A$8:$A$207), "", (Sheet1!$B$2))) the exact formula you use in your sheet? You use absolute referencing in it, suggesting that for every time it appears, it looks at the same cells. Is this really what you want? I would have thought checking each line individually (=IF(ISBLANK(Sheet1!$A8), "", (Sheet1!$B$2)) would do what you describe – cybernetic.nomad

How do I prevent Excel from automatically replicating formulas in tables?

I'm using Excel 2016. I have a table with headers and when I plug in a formula, Excel is automatically replicating the formula to all other cells in the column. While that would normally be fine, it's wrongly calculating the table headers. I thought I could just change the top row to exclude the header but Excel updates the rest of the column which I don't want.
I would like to either turn this automatic formula replication feature off or figure out a way to customize the formula in the top row so it doesn't calculate the header value.
Here's the formula I'm using and I didn't do anything special with the table outside of add a 'Totals' row:
=SUM(B2+C1-D2)
You can stop creating calculated columns. The option to automatically fill formulas to create calculated columns in an Excel table is on by default. If you don’t want Excel to create calculated columns when you enter formulas in table columns, you can turn the option to fill formulas off. If you don’t want to turn the option off, but don’t always want to create calculated columns as you work in a table, you can stop calculated columns from being created automatically.
Turn calculated columns on or off
1) On the File tab, click Options.
2) Click Proofing.
3) Under AutoCorrect options, click AutoCorrect Options.
4) Click the AutoFormat As You Type tab.
5) Under Automatically as you work, select or clear the Fill formulas in tables to create calculated columns check box to turn this option on or off.
Stop creating calculated columns automatically
After entering the first formula in a table column, click the AutoCorrect Options button that is displayed, and then click Stop Automatically Creating Calculated Columns.
In Excel 2016/365 you can also change a cell you want, let it auto-populate the rest of the column, then Ctrl+Z, this will undo auto-populate but keep the new formula/text you just changed in that one cell.
First, why do you wrap a simple formula into a SUM function? I always wonder why people do that when it's much shorter to write =B2+C1-D2 instead.
Second, if you used the true capabilities of SUM() then text, i.e. your column header, would be ignored instead of throwing an error. The + and - operators don't tolerate text, be it in a table or not. You could rewrite your formula to be
=Sum(B2,C1,D2*-1)
Third, be aware that cell referencing like that will behave erratically when you insert rows into the existing table (between existing rows). The row references will be off for anything below the inserted row and you will need to manually copy down the formula again to get correct results.
In order to get a formula that does not require adjusting, you may want to use structured referencing, where each row has exactly the same formula, instead of cell references, where row references are adjusted in each row. A possible formula for this would be (if your columns are labelled data1, data2 and data3 for columns B, C and D):
=SUM([#data1],OFFSET([#data2],-1,0),[#data3]*-1)
To get the data from the row above, Offset() is used on the cell in the current row (using the # sign), with a negative row offset. Keep in mind that Offset is volatile, which may slow down very large datasets.
Adjusting AutoCorrect options is not optimal. You can do it on a col by col basis by:
let the column autopopulate your formula
delete any number of values in the autocalculated column (just one will do the trick).
adjust formulas in the column as you wish
Only able to test in Excel 2013.
May be a little late to open this query - but a couple of points:
formula replication does not work if there are already different formula in the column - may need 3 different formula before Excel says it cannot guess which formula to replicate
a solution could be to add 2 dummy rows at the top which will then prevent the replication - the benefit of this is that you are not disabling replication for any other tables that may be in the workbook; and I'm not sure if the setting may also inadvertently be copied to other new workbooks you create whilst you have the first workbook open
finally, the old chestnut that =A1+B2 etc creates an error if A1 or B2 are not numeric; whereas =sum(A1,B2) works differently in that text will be ignored and effectively treated as zero
If your reference has letters in the middle these technics won't work. To add a zero before the reference in that case, create a new column next to it, add "0" to all the cells next to the references, add another column and use the function "concontenate" or whatever between the "0" cell and the one with the reference.
Not only that, the =len function will correctly tell you the # of digits on references with letters in the middle (because excel does not view them as numbers per se, but rather text/general format) while on other references with 0s added before them with formatting this doesn't happen.
Eg: 012345 =len gives 5 digits / 01A345 =len gives 6 digits

Excel - Remove duplicate row if column value is null

If I have 3 rows in Microsoft Excel with the following data
id name address
id01 john rundown avenu
id02 bill maptown drive
id01 john null
What is the easiest way to remove the third row because id01 already exist AND already has an address? Formula or ribbon buttons...I don't care how.
Thanks for any advice!
There are a number of ways you could do this including a vba procedure. However, one easy way without needing VBA would be to use the next available column to mark rows for delete. If this was column D using the example above then you would paste the following formula into cell D2:
=AND(COUNTIF(A$2:A2,A2)>1, C2="null")
This can then be pasted down the remaining rows. The A$2 reference will remain the same (because of the dollar) and the other A2 references will change relative to the cell they are pasted to.
You can then set auto filter, to only the true records, delete these rows and then unfilter.
Let me know if you would prefer an automated solution as the VBA for this would also be pretty straight forward.

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

Fillng in excel cells automatically using data

I am wondering if and how this can be done:
I have a spreadsheet that has three columns for Highschool name, State and CEEB code.
As of now, we have to manually look up the CEEB code and fill them in.
Is there a way i can give excel the entire list of all HSs and CEEB codes, so when I enter a High School and hit tab, it fills in the CEEB code automatically if it exists in the list provided to excel.
On a separate sheet, list the highschools and CEEBs. If you put the high school name in A1, put this formula in B1
=VLOOKUP(A1,Sheet2!A1:B100,2,FALSE)
with your high schools and CEEBs on Sheet2 and in the range A1:B100. Adjust to fit your actual data. If you don't have anything in A1 and don't want to see an error, use this formula
=IF(ISBLANK(A1),"",VLOOKUP(A1,Sheet2!A1:B100,2,FALSE))

Resources