I have a list of 64 product codes all similar to SDAC30610.
I have also had to append 2 digits on to the end of each cell, and have done that using =sourceA2&"PA", but cannot figure out how to change an existing digit in each cell.
How do I change the 3 to a 4 in all 64 cells?
Can't you try just find and replace all?
Find "SDAC3" and replace with "SDAC4"
Or use replace function, see https://www.exceltip.com/working-with-formulas/replace-a-particular-character-at-specific-position.html
Something like this should work:
=IF((MID(A2,5,1))=”3”,REPLACE(A2,5,1,4),A2)
Then you should be able copy that for all rows in that column.
Related
I'm trying to extract a SN number from multiple types of Chromebooks with different barcode outputs. Below is a photo example.
Is it possible to make one formula to extract the serial number from all barcode types?
Here is my request. I'm wondering if the "=IF" command would work for my needs:
First search for "5CD" OR "5CG" and if its found, extract it with the trailing 7 characters. (10 total)
If "5CD" OR "5CG" are not found, search for P20 and extract it with the trailing 5 characters. (8 total)
If neither are found, keep the cell empty.
Here is a working formula but it only finds one character string.
=IFERROR(TRIM(MID(SUBSTITUTE(A2,"",REPT("",99)),MAX(1,SEARCH("5CG",SUBSTITUTE(A2,"",REPT("",99)))-0),10)),"")
I know this formula could end up very long. Thank you for any suggestions. (I'd like to not have to use multiple columns with multiple formulas if possible)
Use:
=MID(A1,MIN(FIND({"5CD","5CG","P20"},A1&"5CD5CGP20")),IF(ISNUMBER(FIND("P20",A1)),8,10))
Depending on one's version this may need to be confirmed with Ctrl-Shift-Enter instead of Enter.
I have around 30 numbers which are either 1, 2 or 3 digits which are codes. These codes are attached in front of other numbers. I want to know what code is in front of a number, for example for the number 35467036 the first two digits matches with the code 35. So I want the output for that to be 1.5.
This is my current setup, I have a table with all the codes followed by the output in the next column. If all the codes were three digits long I could just do this =VLOOKUP((LEFT(E6,3)&"*"),D1:E3,2,FALSE) but they are unfortunately not.
I have also tried using nested IF statements but I can only go so far as 7 levels.
Will this only be possible in VBS or is there anther way?
Edit:
The code column is formatted to text. If I enter the value 3 into LEFT it does not work for two digits. Is there anyway I can make it work for 1, 2 and 3 digit codes? Also the codes do not overlap, for example, there isn't going to be 96 and 965 in the code table.
Seven nested IFs as a limit points to a very old version of Excel. You may want to consider upgrading to a version that is still supported in this millennium.
But your main problem is that the data type of your lookup value is text, because you concatenate a string with a wildcard. Whereas your Lookup Table's first column is probably made up of numbers.
In order to solve this you will need to add a Text column to your lookup table that represents the numeric value as a text value.
IF you want to use Vlookup, that helper column will need to be the first column of your lookup range.
You can use an Index/Match instead of Vlookup to be independent of the column order, as this screenshot shows:
Column H shows the formula that has been applied in column G.
Edit:
According to the screenshot you posted, you want to look up from the table in columns E to F and this table only has the short codes. Therefore, it makes no sense to add a wildcard to the lookup value. You just need to extract the value you want to use for the lookup.
If you want to lookup only two digits, then you need to extract only two digits. Adding a wildcard does nothing to remove the third digit.
In the screenshot below, a helper column feeds the LEFT() function the number of characters to extract, then uses that value in the VLookup.
=VLOOKUP(LEFT(A1,B1),$E$1:$F$5,2,FALSE)
=INDEX($G$2:$G$5,
SMALL(
IF(LEFT(A1,3)*1=$F$2:$F$5,ROW($G$2:$G$5)-1,
IF(LEFT(A1,2)*1=$F$2:$F$5,ROW($G$2:$G$5)-1,
IF(LEFT(A1,1)*1=$F$2:$F$5,ROW($G$2:$G$5)-1))),1))
=INDEX(LookupValues,Small(ArrayOfRowsFromIfStatements,FirstRow))
This is an array formula so you will need to use Ctrl+Shift+Enter while still in the formula bar.
We use If to build an array of Row numbers where the conditions match or return FALSE if not. The Small function then returns the smallest result in the array which will be the first row where conditions match.
We then index the results returning that row number (-1 deducted from rows to offset the headers).
If your numbers in column A are always 6 digits + the code length you can use this:
=VLOOKUP(--LEFT(A1,LEN(A1)-6),E2:F5,2,FALSE)
I want to convert the numbers from text format to numbers so tha i can make the average or sum of the whole columns.
I tried all the possible ways asfar as i read in many blogs, but nothing works.
There is no Green mark on the cell nor a quote '
Tried copying an empty cell and select required cells and paste special methods also.
It looks like you are using a French version of Excel. In this case a number should be 6,04 and not 6.04
Do a find and replace of . for , and you should be able to change the format to a number if it is not done automatically.
You can either:
change the values to numbers
use a formula that can handle text-type numeric values
Say we have data in column A that is Text. This formula:
=SUMPRODUCT(--(A:A))
can give you the sum without having to convert first:
I would like to create a way to search through column "B" and replace the last two digits of values listed.
For example,
I'd like to have,
502040155 replaced to 5020400,
403041055 to 4030400,
603054055 to 6040500,
etc.
I'm assuming a LEFT or RIGHT formula is needed? VBA or formula works fine.a
I'm going to assume that your last example was a typo. Try,
=FLOOR(A2/100, 100)
I have a problem with my current code from Excel VBA.
I need to take only the last four digits from another spreadsheet, but it doesn't seem to be possible.
I'm currently using the Sheets("Sheet2").Cells(y, cOTr).Value instruction to take values of other spreadsheets and the LEFT(a,2) and RIGHT(a,2) instructions to take only specific characters of a string data.
I just can't find a way to combine those two instructions.
E.g. I want to copy only the first 4 numbers of Cells from the second column from sheet 2, which has the numbers similar to 6657-2 in it, to sheet 1.
Sorry if my explanation wasn't clear enough.
Edit: Lets's say I want to make a comparison between a table from spreadsheet 1 and a table from spreadsheet 2: the first table has values with four digits (e.g. 3333) and the second has values with 4 digits, a hyphen and another digit (e.g. 2222-3). I need to make a comparison between table 1 and 2, which are from different spreadsheets and to do that I only need the first four digits from table 2. I already have the logic for the program and it's running perfectly with some tests I did with only 4 digit numbers, I only need a way to take those first four numbers, something like using the "left(cells(1,2),2)" instruction but with cells of another spreadsheet.
You can combine text / strings by using the ampersand operator &
e.g.
=LEFT(A2,2) & RIGHT(A2,2)
Alternatively, you can also use CONCATENATE
e.g.
=CONCATENATE(LEFT(A2,2),RIGHT(A2,2),"some other string","and so on")
you can us this formula: =LEFT(Sheet2!A1,4).
Sheet2 A1 is where you have data 2222-3.