a) Write VBA code that takes a user-provided MAC address from cell C7
b)Displays the portion of the MAC address that identifies the manufacturer of the hardware network
adapter, with colons, and centered in cell C10.
c) Displays the portion of the MAC address that identifies the manufacturer of the hardware network
adapter, without colons, and centered in cell C11.
d) Displays the portion of the MAC address that identifies the serial number of the hardware
network adapter, with colons, and centered in cell D10.
e) Displays the portion of the MAC address that identifies the serial number of the hardware
network adapter, without colons, and centered in cell D11.
f) Cells B7, B10, B11, C9, and D9 should display the labels shown in Figure 1. These labels need
to be displayed in BOLD type.
g) Your sub procedure should end by selecting cell C7.
h) Assign your (main) sub procedure to a rectangular shape button labeled “MAC Address
Information”.
I need a VBA Excel code to split data in Cells.
This was the final looks like
Thanks so much
To get your Manufacturer number, you just want to write the first 8 characters of C7 to C10:
Range("C10").Value = Left(Range("C7").Value,8)
To remove the colons, you would use Replace
Range("C11").Value = Replace(Range("C10").Value,":","")
I'll let you work out what to do with D10 and D11 but here's a hint: you don't want the Left..
Related
How do I insert specific text into varying places in a string? It is to add details to addresses that are missing.
I'm aware I can use the LEFT and the MID functions to do this, but when the address data varies in length it fails, however it always has to come after "Faketown" in my example.
For example:
Cell A1 may contain
123 Fake St, Faketown, AB1 2CD
Cell A2 may contain
12 TotalFake St, FakeTown, EF3 4GH
I'd like a formula/macro for the column next to it to show:
Cell B1
123 Fake St, Faketown, Fakecounty, AB1 2CD
Cell B2
12 TotalFake St, FakeTown, Fakecounty, EF3 4GH
As you can see it's the addition of "FakeCounty" in the format above that is required. The formula/macro should always put "Fakecounty" after "FakeTown" regardless of how many characters precede FakeTown (otherwise the 'LEFT' and 'MID' functions would be perfect).
I'm certain it's possible, but can anyone point me in the direction I need to go/provide a formula/code that can achieve this?
I need an excel formula that searches within a range, a cell that contains a word with letter "W" and then multiply the number stored in the cell from the right of it by 2 and display the sum of all this multiplied values in another cell.
Example: Range A4:Y4; B4 contains word "Woo" and C4 contains number "3"; E4 contains word "Wood" and F4 contains number "5"... I need Z4 to contain C4*2+E4*2+...
Please help me with that.
Try this in Z4:
=SUM(SUM(OFFSET($A$4,,IF(IFERROR(FIND("W",$A$4:$Y$4),0)>0,COLUMN($A$4:$Y$4)))))
Hit CTRL + SHIFT + ENTER.
Make sure A4 is not a number (otherwise this formula counts the value of A4 times the number of cells that don't contain "W").
If you want to count cell as well that contain small w's, use SEARCH instead of FIND (SEARCH = case insensitive; FIND = case sensitive).
Keep in mind: OFFSET is a volatile function, i.e. if you have a large datasheet, this might slow down the work a bit.
Found it!
=SUM(IFERROR(2*(LEFT(A4:X4)="W")*B4:Y4,0))
Commit this formula using CTRL+SHIFT+ENTER and not just Enter by itself.
I am posting this question because I had a hell of a time trying to find the answer myself.
Basically I have a cell that references a cell that references another cell with some data in it. For example, A3=A2 and A2=A1 and cell A1 contains the text Hello. So cell A2 and A3 also contain the same text. See picture below:
But let's say I actually want cell A3 to show data relative to the cell position that A2 is pointing to (Remember A3=A2). I need to use the OFFSET function to do this and one would think that A3=OFFSET(A2, 0, 1) might work (click here to see how OFFSET works). But OFFSET does not work by itself. It would return the data from the cell to the right of cell A2 (shown below), instead of realizing that A2 points to A1 and then returning the data to the right of A1.
So how then do we get cell A3=B1, indirectly, by going through cell A2?
We need to use a combination of functions, one of which is INDIRECT. click here to see how INDIRECT works. So in order to use INDIRECT we need the text found in cell A2. The FORMULATEXT function (more info) will extract =A1 from cell A2 when used like so in cell A3:
A3=FORMULATEXT(A2), shown below:
Now we just need to strip off the = from the text so that we have an actual text reference that INDIRECT can use. You can do this using either the RIGHT or MID functions (right, mid) in combination with the LEN function (length). You need LEN if the number of rows in your sheet goes from single digit numbers into double digits, and so on. You also need to pass in the FORMULATEXT function again so it can compute the length of the text =A1. If you don't, it will compute the length of Hello. You also need to be aware that LEN()-1 is the correct length you need, since you are throwing away the = from the text.
For example: A3=RIGHT(FORMULATEXT(A2),LEN(FORMULATEXT(A2))-1) giving us:
Put it all together and you can OFFSET the cell that A2 references from A3 with INDIRECT like so:
A3=OFFSET(INDIRECT(RIGHT(FORMULATEXT(A2),LEN(FORMULATEXT(A2))-1)),0,1)
I would like to enter information in a cell based on the text contained in a different cell. Specifically, if a cell in column A contains text that includes "insurance," "retirement," or "401K," then I want to place an "x" in its respective cell in Column B. If not, then cell B1 should be empty. The text needs to be contained within the cell, but does not need to be the exact text. E.g., an "x" would still be placed in the column next to "life insurance" or "insurance," "whole life insurance," etc.
E.g.,
Column A Column B
Life Insurance x
Securities
Retirement x
I tried to use the following formula, but am getting an error message when I do so:
IF(OR(ISNUMBER(SEARCH("insurance",A1,"retirement",A1, "401K",A1)),"x", "")
Any thoughts?
This formula should help:
=IF(OR(ISNUMBER(FIND("Insurance",A1)),ISNUMBER(FIND("Retirement",A1)),ISNUMBER(FIND("401K",A1))),"x","")
EDIT:
I came up with an array formula that I like a little better. Hope this helps:
=IF(COUNT(MATCH({"*Insurance*","*Retirement*","*401K*"},A1,0))>0,"x","")
This will require pressing CTRL + SHIFT + ENTER instead of just ENTER after putting it in the cell because it's an array formula.
I have a CSV file imported into Excel 2010. One cell contains a portion of text that I want, but it is of different lengths and locations within the cell. Not every record has data in the cell. Each piece of text is delimited by a semicolon (;) but still within the same cell. So:
B2 = text_I_want
B3 = blank
B4 = text_I_don't_want; text_I_want_that_has_a_different_length; more_text_I_don't_want
B5 = text_I_don't_want; text_I_don't_want; text_I_don't_want; text_I_want_now;
Column M of the same row should contain the entire text I want but only what I want. So:
M2 = text_I_want
M3 = blank
M4 = text_I_want_that_has_a_different_length
M5 = text_I_want_now
There are more than 10,000 records to go through and would appreciate help.
EDIT: I didn't explain myself clearly. Column B contains a string of text which contains various hyperlinks. Each cell could contain zero hyperlinks, one hyperlink, 2, 3, 4 and so on. Each hyperlink is separated by a semicolon. I want only the amazon.com hyperlinks, not the amazon.ca or amazon.co.uk or any other hyperlinks. I hope this is a clearer example, with what I want in a separate field, bolded.
-B2 = amazon.com/12345
-B3 =amazon.ca/search?keywords=William+Shatner
-B4 =amazon.ca/12AB; amazon.com/AB1; loc.gov/fubar
-B5 =amazon.com/978037346; amazon.de/search?VX123
EDIT #2 - Since I can convert the text to columns, how about this questions: how do I search a row com columns A-G for any cell containing amazon.com and then copy that cell contents into column M?
You can use Find/FindB (depending on whether your content is single byte or MBCS data - the ones ending in B are for MBCS data).
In N2, for instance, you can use
=Find(M2, B2)
N2 will contain the offset (index) of the text in M2 in B2, or zero if it's not found.
To extract the text, use Mid/MidB and Len/LenB. You can add this in P2, for example:
=IF(N2 > 0, MID(B2, N2, LEN(M2)), "")
This checks to see if the value in N2 is greater than zero, and if it is copies the text from B2 starting at the position indicated in N2 for the number of characters returned as the length of the text in M2. If N2 is zero, it returns a blank space.
You could, in fact, combine both operations into one (it's a little harder to read):
=IF(Find(M2, B2) > 0, Mid(B2, Find(M2, B2), Len(M2)), "")
Based on your first edit, with amazon.com/ in B1 (for the sake of flexibility) then:
=IF(AND(IFERROR(FIND(";",B2,IFERROR(FIND($B$1,B2),"")),"")="",IFERROR(FIND($B$1,B2),"")<>""),B2,IFERROR(MID(B2,IFERROR(FIND($B$1,B2),""),IFERROR(FIND(";",B2,IFERROR(FIND($B$1,B2),"")),"")-IFERROR(FIND($B$1,B2),"")),""))
(copied down as required) should work.