Getting Data In Array Into List Format?
Mar 16, 2014I have text in an array (there are formula in all the fields) and I would like to arrange this text so that it is in a list format.
View 1 RepliesI have text in an array (there are formula in all the fields) and I would like to arrange this text so that it is in a list format.
View 1 Repliesin C a string is nothing more than an Array of characters ending with a null character.
in VBA this does not seem to be the case.I am trying to use the BlowFish code from David Midkiff for some encryption, however the code sometimes fails:
When encrypting a string a string of a specific length should be returned. however sometimes one of the characters of the encrypted string is a null character, and the returned encrypted string (with a embedded null character) is causing me problems. I want to check for the null character and if present redo the encryption. But how do I check for the presence of this null character in a unicode (double-byte) string?
Checking with Len(encrypted) gives the correct length (!) but trying to move each (unicode)character into an array fails when using the Mid() function past the null character in the string.
Now I can use
byteArray() = StrConv(unicodetext,vbFromUnicode)
to get the lower byte of each character into an array easily, but how do I do this for both bytes of the unicode characters?
Using an integer array does not work other than through
intArray(j) = CInt(AscW(Mid(Outp, j, 1)))
which fails on the nullstring in my encrypted text.
I have tried with variants but so far no luck. I thought if the string was entered into a variant then I could also address the variant as an array of bytes, but that does not seem to be accepted by VBA.
I am looking to create an array where values are based on a data validation list.
i.e. in cells C5:C65 which have a data validation list of "Active" and "Not Active". Once a cell has been selected as "Active" then all other cells are in that range are automatically "Not Active".
The answer I am sure is an If and Lookup or something but what I have been creating today feels like a sledgehammer approach with helper columns and all sorts - I really want to avoid an array or anything that will chew up processing power...
I'm not sure if this is possible but I am trying to find a function that will organize data that will be in a set 2-dimensional array (ex. 6 x 8) into a single list column. The trick is to omit any blanks that may be in the array so that the final list contains no blanks.
This is for a template; the data will constantly be changing so it's not a one time project where I can just sort the data to omit the blanks.
In the example I am trying to automatically have the 'Initial Group' organized to look like the 'Final List.'
I need to export this to Xcelsius which doesn't support any macros/vba. Btw I can;'t use Row() in xcelsius too.
[Code].....
I have a consolidation workbook and source files.I would like to convert the data from the source files into a list format in the consolidation workbook.
I have attached a sample of the sheet format of the source files in the attached file, called 'Page 5'. The other 2 sheets are 'Template' and 'Instructions'. The 'Template' sheet is what I imagined would be the list format of the data copied from the 'Page 5' sheet. Instructions is where the lookup table for currency is.
So basically starting from row 8 in 'Template' sheet, I would like to copy and paste from 'Page 5' sheet to 'Template' sheet:
- H2 to A8 & B8
- B2 to C8
- According to the list of currency in 'Instructions' sheet, lookup the currency according to operating unit in C8 and paste to D8
- D5-I5 to E8
- row A8-A23 to column F-N
I actually have had a similar problem before, which Derk has helped me here - link: Use Access or XL? (I've decided to start a new thread because this is a more relevant forum).
I have tried to modify the code but I am rather lost as to which part I am supposed to modify.. Note that in this code, the source data is in separate file instead.
Sub add()
Dim wb As Workbook, f As Worksheet, t As Worksheet, j As Integer, k As Integer, n As Integer
Dim mty As String, yr As Integer, d As Date, bu As String, cur As String, sTodo As Variant
sTodo = Array("Page 5") 'finish adding the names
Application. ScreenUpdating = False
Set t = Workbooks("Example1.xls").Worksheets("Template")
i = t.Cells(65536, 2).End(xlUp).Row
VBA code which can distinguish whether a cell has been edited by:
selecting an option from a data validation list (DVL)
or
manually editing the text in a cell?
The ""Show error alert after invalid data is entered"" option is unticked to allow both selection from the DVL as well as free format text entries.
The problem arises when using the code below which makes an edited cell within a range display the new value as well as the prior value(s). This works well when using the DVL but not when editing the cell.
Is there any code which can distinguish between the 2?
[Code] ....
How to conditionally format an array formula? The basic formula is an index(match criteria1 and match criteria2. I have come across sites where they mention you can incorporate aggregate into the formula to remove the Alt+Ctrl+Shift thus allowing for the formula to work in conditional formatting. Shown below is the formula I am trying to use. Basically if the formula below = today() then be yellow.
{=IFERROR(INDEX(Table2[Comp Req Date],MATCH(1,([@[SLDR_EF]]=
Table2[Component Material])*([@[Grand Sequence]]=Table2[Order Seq Num]),0)),"")}
This has been kicking my can all morning! Should be simple. I'm trying to conditionally format an array from the value of a single cell.
=IF(A1<80, A3:A24,RED,0)
=IF(A1>80,A3:A24,GREEN,0)
=IF(A1>120,A3:A24,BLUE,0)
I am trying to make an encode/decode function to use in excel from base64 to array of bytes
I want to put string encoded in base64 in cell1 and get result in cell2 with decoded array of bytes and vice versa i find some codes [URL]....
and a code here
[URL]....
using the code above to convert A1
A1 = a03060fa564665
ENCODEBASE64(A1) -> YTAzMDYwZmE1NjQ2NjU= (which is correct result for string "a03060fa564665" not the array of bytes)
while correct result i need is oDBg+lZGZQ==
i know the issue is converting string to array of bytes but i couldn't fix it myself
example
if cell1= a03060fa564665
result1= oDBg+lZGZQ==
if cell2= oDBgm1BGaQ==
result2= a030609b504669
I have a list of data for each year dating back 10 years and some of lists had entries that weren't available so the cell showed up #N/A. I searched and replaced them with 0 but when I graph the data it skews my graph. I was wondering if it was possible to take a logic (IF) statement that says if the cell = 0 then take the average of the next and previous data points so the graph looks smooth. i.e. =IF(G444=0,(G443+G445)/2,G444) This gives me the correct number i want, but i want to apply it to all my lists like a format if possible.
View 1 Replies View RelatedI have a VBA subroutine that builds a list of dates in an array and then copies this to the worksheet using worksheetfunction.transpose. The array is two dimensional and therefore uses the variant data type.
This works fine in Excel 2002. In Excel 2003 the array is fine until the Transpose function is used, at this point they are changed from dd/mm/yyyy to mm/dd/yyyy. This means that some dates are changed (eg: 01/Mar/2008 becomes 03/Jan/2008) and some are written as strings (eg: 17/Mar/2008 becomes the string "17/03/2008" and cannot be operated on as a date).
I'm aware that there was a hotfix to deal with a similar issue regarding recalculation but this is on Excel 2003 SP3 which should already have that hotfix in place.
I have reduced my code down to a basic demonstration showing the problem. This assumes the worksheet contains some dates in "A2:A32". I have also attached the workbook containing this code.
VB:
Private Sub CommandButton1_Click()
Dim a() As Variant, c As Integer
Redim a(1 To 31)
For c = 1 To 31
a(c) = Cells(1 + c, 1)
Next c
Range("D2:D32") = WorksheetFunction.Transpose(a)
End Sub
I have fixed this problem by looping through each element of the array and writing them individually in to cells but this is far slower so I'd like to know if there is a better solution than that.
I need to format some climatic data from a weather station into a desired format. There are a lot of cut&paste and transposing involved. I think it will be easy but tedious for anyone trained in VB to write a macro but unfortunately I am not. I've tried recording a macro but it turns out that it is not general enough to deal with all the spreadsheets that I've got.
I've attached a spreadsheet which shows the original format (in sheet 1) and the desired format (in sheet 2). To briefly describe, I only need the temperature data for 8am and 2pm, the rest of the information in sheet 1 is useless to me.
On one sheet (KPI) I have either the values "x" or "" in the range A84:A89 to mark wheter to use the corresponding project in the range B84:B89. On the sheet X-ref I have the same project names in range T4:Y4 and a corresponding target value in T8:Y8
What I want is the sum (or average) of the marked-projects target-values. The result should end up in KPI!G31.
In other words I want
=sumif(A84:A89;"x";'X-ref'!T4:Y4)
but it doesn't work since the first range is an column-array and the second range is an row-array.
I am trying to create a list from an array. Said array contains formulas that return numbers from input contained in an other table. I would like the list to list the numbers in ascending numerical order.
View 5 Replies View RelatedI have a data array which i would like to convert to a list. Sort of the reverse of a Pivot Table
See example below
I would like to turn this
Account Jan Feb Mar April etc..
001 59 30 25 40
002 12 20 32 29
003 5 13 27 39
004 10 11 12 13
Into This
Account Month Amount
001 Jan 59
001 Feb 30
001 Mar 25
001 April 40
002 Jan 12
002 Feb 20
002 Mar 32
002 April 29
003 etc...
There is a sample of the data file attached.
How to compare to a string of objects
1. TH0102
2. KJ1403
3. KJ1404
4. TC0910
5. TC0905
Example :
if column data A2 (TC0905) match to any of the objects 1 to 5 , it will return me TRUE. if(A2=(1,2,3,4,5),TRUE)
I have a question regarding arrays. If I have too many elements in a 1D array(let's say 1000), how can I list all of them in a msg box (separated by comma)?
View 2 Replies View RelatedI have created an analysis worksheet but need to a formula that looks up against a list, hence why I think (and hope) that this might just need an array formula.
So the worksheet has a few thousand rows of data (one for each order) that is put against an email address. I need the formula to sum the revenue generated by 'club members' who placed on a specific date whos email appears in a list on a seperate tab. If it wasnt for the email list I would use a simple sumifs formula but I am stumped by the need to look up against a list of emails.
As close as I've got is the following;
=sumifs(data!AC:AC,data!Z:Z,"Club",data!L:L,B11,data!S:S,'Discount'!B:B)
the data tab is the one with all the data and the discount tab contains the list of email addresses to look against (B:B). AC is the revenue data, Z is whether they are club members, L is the data (B11 is the date to look up against).
I have a list of combo boxes embedded on a worksheet and I would like to have them accessible through an array. I am an old VB 5 coder and this was a method I used very often and found it to be quite the time saver, but I cannot find a way to do this in excel.
View 9 Replies View RelatedI have around 30k data. which is in invalid format.
Ex: 12987654321vinay kk 876543219
32567456789 kkccjhg fo 345678921
I want to convert this into correct format as below with start letter from
MOD, 987654321,, vinay, kk,87654219
MOD,567456789, , kkccjhg, fo,345678921
I want to know which are formulas I have to use to get this info in correct format.
I am trying to create a purchase order that has blank item cells, but when you click on one a drop down list appears. By selecting the appropriate item, I would like the price to come up in the next cell for the item selected.
What would be even better is if once that was done there is a cell next to the item and price and this cell will be for the type of the item selected. In this case the flavour, flavours are specific to different item though?
I think the first bit can be done through a drop down list of some kind, not to sure about the flavours drop down menu though.
I know you can read a range of data into a ListBox with a single command. can you read the contents of a ListBox into an array with a single line, and if so what is the syntax?
View 2 Replies View RelatedI've created a range B3:B12 in which each cell returns TRUE of FALSE. There corresponding values are listed in C3:C12. I have the same thing again in D3:D12 and E3:E12. Checkboxes link to the TRUE/FALSE cells. Attached is a stripped down file to show this.
I want to create a formula that lists each item in the one cell (no spaces required inbetween) for use with a search. I know a long winded way to do this involving many IFs but any array will be much more tidier, thing is I hardly use arrays and have struggled with this one.
I'm thinking it will be along the lines of =IF(B3:B12="TRUE",C3:C12,"")&IF(D3:D12="TRUE",E3:E12,"") but exactly what it should be is beyond me.
EDIT: The original file attached was corrupt for some reason, the new attachedment is the same except instead of TRUE/FALSE cells I've set them to 'x' for quickness (lost my work...!).
I'm looking for array formula that will condense a long list like this:
a
a
a
b
c
b
d
To this
a
b
c
d
I have in column B, cells that have any number, one number or several like B2.
#
A
B
C
D
E
[Code]...
Thinking that I have a loop for rows 1 to 3:
When in column "A" is "No", I want to consider values in C and D to get:
Code:
a[1]=Cells(1,"C") & "-" & Cells(1,"D") & "-" & "ABC"
But when in column "A" is "Yes", I want to store in array each value within cell in B (in this example B2) to apply later a For/For Each
over each number (in this example are 3 values only within cell B2), something like:
Code:
a[1]=Value_In_B2[1] & "-" & "ABC"
a[2]=Value_In_B2[2] & "-" & "ABC"
a[3]=Value_In_B2[3] & "-" & "ABC"
I am working on data that needs to be cleansed of the symbols i.e. *&/- etc so I am hoping that I can automate this as their are over 30,000 rows of data and takes time to go through each find and replace.
View 9 Replies View RelatedHow do I set a ComboBox list to read values from an array? I tried the following in VBA, but it didn't work....
ComboBox1.List = Array("January", "February", "March", “April”, “May”, “June”, “July”, “August”, “September”, “October”, “November”, “December”)
I have a List like this (a large one in practical)
A B 1 cat dog 2 rat cat 3 bat cat 4 cat rat
At the bottom I want to generate an array which gives what are the text entries of this list.(ignore multiple occurrences)
so the answer should be
cat
rat
bat
dog
Need a way to generate a list (i.e. array) of tabs available in the current spreadsheet?
View 3 Replies View Related