Reputation: 1
I would greatly appreciate help on this issue I am having with excel
I have a table in excel and adding rows of data to it. For one column I am creating a unique number based on 4 cell values, and then have the last digit increment + 1. Right now I have a formula
=IF((OR($B5="BF",$B5="AD")),LEFT((TEXT([@(Current Date]],"MM"),2)&"-"&RIGHT(TEXT([@Current Date]],"YY"),2)&"-"&[BF/AD]&"-"&[CODE]&Rows()-4,"")
so the output looks like 07-21-BF-QA-1 and then the next row would be 07-21-BF-QA-2
so everything works BUT I can not use rows because I do not want the last number to change when a row is deleted. For auditing purposes, I need the number to not change. I have spent so much time trying to figure this out and no luck. I keep looking at alternate functions instead of rows but keep running into the same issue of the number automatically changing.
Please help!!! Thanks in Advance.
Upvotes: 0
Views: 272
Reputation: 715
You can achieve the desired result with the following approach:
Just replace your ROWS()-4
command by ROWS([Tabname]!A1)
.
The tab bar looks like this:
or (if Rows is hidden)
In my example, the formula is on Output, and ROWS()
references cell A1
on Rows tab.
Output at the beginning
Output after removing row #6
Note: Please note, that Excel has two to options for hiding tabs (xlSheetHidden and xlSheetVeryHidden). While the first one can be applied and undone via the Excel GUI, the second one can only be set and changed via VBA. Check Worksheet's Visible property.
Upvotes: 1