I have a simple spreadsheet in Excel 97-2003 format, extension is XLS, that is throwing the following error when trying to load it with PHPSpreadSheet.
Error 0 on line 49 in \PhpSpreadsheet\Cell\CellAddress.php -> Row and Column Ids must be positive integer values
The spreadsheet has 14 columns with no formulas or external references. Similar spreadsheets in the same format load and process without error.
require 'PHPSpreadsheet/autoload.php';
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xls();
$spreadsheet = $reader->load($inputfile); // <-- this is where the failure happens
If I create a new spreadsheet and copy the rows from the one that fails into the new one the load works just fine. The header row and 1 row of data are shown below. I have tried removing the header row and manually entering a single row but get the same failure.
It seems to be related to the file itself but the error message isn't helping to determine exactly what the problem is.
DATE Course ID Title of Class StartTime PGH Location Address City State Zip Code Sponsor/Vendor Instructor if Known Contact Information Telephone
1/10/2023 7280801 Dual Credit Water & Wastewater Workshop 08:00 6 Anywhere Fire Department 123 Main St Any Town NC 28580 NC Statewide Safety Conference, Inc. Sam Smith Joe Smith 252-555-1212
This was caused by a bug in PHPSpreadsheet that was revealed by having a vertical break in row H0 for some reason.
Removing the breaks in the spreadsheet manually would also correct the problem but the latest version of PHPSpreadsheet has been fixed so it will not thrown an error if there is a vertical break in the first row.
Related
I have a table with names on the left and corresponding work schedules to the right. I've created a separate table with some of those same names and want it to automatically fill in the corresponding work schedule for that person. Seemed simple but I'm very stuck. My level of experience with Google Sheets is what is stopping me from solving this.
Example Tables:
In the attached picture the table on the top is the original (hardcoded) data. The table on the bottom is where I want the schedule data to be automatically produced based on the name on the left. The fields with #N/A and #ERROR! are both failed formulas I tried. #N/A should have returned B7:G7. #ERROR! should have returned B4:G4.
I tried the 'LOOKUP' function with ARRAYFORMULA(INDEX) hoping to have it look up the value in the column and input the work schedule data that corresponds.
=LOOKUP("Clair",A1:A9,ARRAYFORMULA(INDEX(B1:G9)))
yielded an #N/A.
Started trying to use =If(REGEXMATCH(A13:A21,"Clair"),... ...) but the '... ...' shows where my intellectual limits are at the moment. I couldn't finish it because I think it's the wrong formula to use.
Something like this maybe?
Remove everthing in B13:G17, and put this formula in B13
=BYROW(A13:A17,LAMBDA(NAME,XLOOKUP(NAME,A1:A9,B1:G9,"NOT FOUND")))
BYROW() work with an array row by row, the given data A13:A17 has only 1 column, which is the name of staff as lookup value.
Details: https://support.google.com/docs/answer/12570930?hl=en
XLOOKUP() scan an array for a key value (lookup value), and return another array with corresponding row or col index.
Details: https://support.google.com/docs/answer/12405947?hl=en
try:
=INDEX(IFNA(VLOOKUP(A13:A17; A1:G10; SEQUENCE(1; 6; 2); )))
Hello and good day everyone!
I need your help and advise, i've one set of table and data as per below, and i'd like to use a formula to extract specific value from a single cell by using some value as indicator to indicate which text's line to extract.
Given the sample table as below,
Column A
Column B
Column C
This is example of the long texts value with multiple linethis text is very long also included value as below,Company: Apple IncContractor name: John Wick the value above, is per line.. and this text continue.. continue text..example text again..
This is where i'd like to display the Company name extracted from Column A
This is where i'd like to display Contractor name extracted from Column A
Example of what i want to achieve,
Column A
Column B
Column C
This is example of the long texts value with multiple line this text is very long also included value as below,Company: Apple IncContractor name: John Wick the value above, is per line.. and this text continue.. continue text..example text again..
Apple Inc
John Wick
I've tried with
LEFT()
MID()
=LEFT(A2,SEARCH("Company",A2)-1)
=REGEXREPLACE(A2,"(.*)Company(.*)","$2")
with no success.
May I request your advise and help on this please!
Thanks in advance.
In your situation, how about the following sample formula?
Sample formula:
Retrieve "Company name".
=TRIM(REGEXEXTRACT(A1,"Company:(.+)"))
Retrieve Contractor name
=TRIM(REGEXEXTRACT(A1,"Contractor name:(.+)"))
Testing:
When these formulas are used, the following result is obtained.
Note:
For example, the base data is put to the cells "A1:A3", you can also use the following formulas.
=ARRAYFORMULA(TRIM(REGEXEXTRACT(A1:A3,"Company:(.+)")))
=ARRAYFORMULA(TRIM(REGEXEXTRACT(A1:A3,"Contractor name:(.+)")))
Reference:
REGEXEXTRACT
To give some detail, I am using Google Forms + Google Sheets to make an easy database that collects all the bank information I put in (Income, savings, expenses, etc.) and I can keep track of details with easy sorting.
I'm stuck on a formula that I can't seem to figure out. Before I go in to specific details of my code I will give a small explanation. The cell I am trying to populate [with the formula] is supposed to take 2 pieces of information from the form response sheet (I will refer to it as 'rawdata') and produce a value (number) from another cell in 'rawdata'.
So in 'rawdata' I have a column (B) that has a value of "Expense" or "Income" for a form response line. I have a column (D) in 'rawdata' that has the value of "Amount" for the number submitted.
Cells in reference in 'rawdata':
B9 = "Expense"
D9 = 67.37
Now, due to the original 'rawdata' being a form response sheet it inserts new rows every response, so my attempt at just calling direction to the cell fails upon a new response submission because it increments on its own. So that being a solution is out of the question.
So, for every other cell I am using to display values from 'rawdata' in an organized sheet I use =INDEX() to pull the value from that exact row and column, instead of the cell reference and it has worked so far.
=INDEX(rawdata!$B:$B,ROW(9:9)) displays "Expense" from 'rawdata' in B9 as a result. So the rest of the cells are formulated this way and I have had no issues.
When I got to the amount, I used an =IF() formula to pull the value from the D column and to display it either as a negative or positive depending on what column B states.
=IF(rawdata!B8="Expense", -rawdata!$D9, rawdata!$D9) displays -67.37 as a result.
But since I can't use this formula to fill empty cells for future use I have to find another way to do so. I figure;
=IF(=INDEX(rawdata!$B:$B,ROW(9:9)) = "Expense", =INDEX(-rawdata!$D:$D,ROW(9:9)), =INDEX(rawdata!$D:$D,ROW(9:9)))
is my solution to the problem, because to me it makes sense. But it fails and gives me a Parse Error.
So when I try to run the first =INDEX() with the values of 1 or 0 being the outcome of the =IF() it also fails, so I create a new column in the sorted table to pull the data of "Expense" or "Income" so I can reference that.
Cell in 'processeddata':
E9 = "Expense"
=IF(E9="Expense", 1, 0) displays 1 as its result, so I figure this is the solution to my problem.
=IF(E9="Expense", =INDEX(-rawdata!$D:$D,ROW(9:9)), =INDEX(rawdata!$D:$D,ROW(9:9)))
displays #ERROR with the description Parse Error.
=INDEX(-rawdata!$D:$D,ROW(9:9)) displays -67.37
=INDEX(rawdata!$D:$D,ROW(9:9)) displays 67.37
I'm at a loss for what to do now. I've exhausted myself with tons of searching on here and all over google, tried using things like INDEX and MATCH, VLOOKUP, etc but can't solve this to save my life. Does anyone here have a clue how I can solve this with a cell reference that won't increment when new rows are added in 'rawdata'?
PS. I've also attempted using =VALUE() to try and convert the =INDEX() to a number but no luck.
Your formula has superfluous equals signs (=). Try Insert > Column and this formula in row 8 of the new column:
=arrayformula( if(rawdata!B8:B = "Expense", -rawdata!D8:D, rawdata!D8:D) )
Your formula has some equal signs in it that are probably the issue.
Instead of this:
IF(=INDEX(rawdata!$B:$B,ROW(9:9)) = "Expense", =INDEX(-rawdata!$D:$D,ROW(9:9)), =INDEX(rawdata!$D:$D,ROW(9:9)))
try this:
IF(INDEX(rawdata!$B:$B,ROW(9:9)) = "Expense", INDEX(-rawdata!$D:$D,ROW(9:9)), INDEX(rawdata!$D:$D,ROW(9:9)))
Also, an array formula is a great tool for Form data calculations. In this file you can see a formula in Column F that does a calculation in each row of the responses sheet from this form, it will continue to update as new entries are made. Feel free to enter submit some form responses.
I have a question for my current Spreadsheet A.
Now I'm trying to make a new sheet for report generation where:
Report shows each ticket recorded on spreadsheet A.
Each ticket have 3 recorded process time. (Verification, Repair, QA)
The month for when the job ticket is first registered.
For illustration purpose, new sheet should look like this:
Ticket ID
Verification
Repair
QA
Month
T-001
X Hour
Y Hour
Z Hour
9
T-002
X Hour
Blank if no recorded time
Blank if no recorded time
9
...
...
...
...
...
Can Google Sheets do that? If can, how do I do it?
I have tried looking for some tutorial videos on Vlookup/Hlookup/Query/Search/Find, but I cant seem to get the results I needed.
EDITED: Changed question 3 from Name to Month
My solution is not the most elegant but it works:
https://docs.google.com/spreadsheets/d/1dEMYbI751pp55YF5M0V19U0QbytsabgwAO_97I1LXqw/copy
First get all ticket names using UNIQUE formula
=unique(C3:C)
When you got it, you have to find rows using 2 conditions:
Process & Ticket. In order to get it using VLOOKUP I make temporary array that contains Process and Ticket columns stitched together and duration column.
Then I use VLOOKUP using 2 stitched keys
=ifna(
arrayformula(
vlookup(G2&$F$3:$F,ArrayFormula({$B$3:$B&$C$3:$C,$D$3:$D}),2,false)))
Ifna prevents from error messages displayed when no value is found.
First arrayformula lets work this formula for an entire column.
Last task is to determine name of an employee. I use vlookup, but as name is futher left then Ticket, I have to make a temporary array {C3:C,A3:A} to search for name.
Warning: Vlookup is listing only first name found on the list.
I set up this spreadsheet to take attendance over Zoom each Am with my students. Students fill out a Google Form to check in. Their data goes into a connected spreadsheet, which in turn goes into a sheet displaying student attendance.
Prior to any student data being entered, the cells in rows 3-6 have an error message:
Error: Query completed with an empty output.
Then when a student name populates one of these cells, the following message appears:
Error: Array result was not expanded because it would overwrite data in G3.
What I want to happen is for a student name to be displayed (complete with conditional formatting).
Here's a link to the spreadsheet: https://docs.google.com/spreadsheets/d/1DpERPaq8yIwDKHkp4T463D6GL5WHAVwHAVYqGmHNJxQ/edit?usp=sharing
The syntax of your query should be corrected.
Please use queries using the following pattern:
=query(FormResponses2!D2:G, "select D Where D is not null and D contains 'Anh'")
(Please adjust ranges to your needs)
Functions used:
QUERY
One of the the I discovered with this #REF error is that if you are looking up by date and have duplicate values of the same date you are looking for in the lookup data, then you will encounter the same error.