Xlookup returns date code and won't cell format

Rob_010101

Board Regular
Joined
Jul 24, 2017
Messages
198
Office Version
  1. 365
Platform
  1. Windows
I'm having an issue where the following xlookup
Excel Formula:
=XLOOKUP(@A:A,PAYE!AC:AC,PAYE!F:F,"",0)&XLOOKUP(@A:A,Contract!W:W,Contract!F:F,"",0)

Returns the date as a code and refuses to format into the date format below.

1727684054508.png


I have manually typed the top code into a separate cell and formatted as date and it works, so it looks like the formula is what might be preventing it.

In previous versions of excel, on vlookup, going back and cell formatting the 'return array' as date would solve this but I have attempted this and still no luck.

Any help appreciated.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
that looks like text
maybe try *1 or +0 at the end of formula to change back to a Number
 
Upvote 0
that looks like text
maybe try *1 or +0 at the end of formula to change back to a Number
Excel Formula:
=XLOOKUP(@A:A,PAYE!AC:AC,PAYE!F:F,"",1)&XLOOKUP(@A:A,Contract!W:W,Contract!F:F,"",1)

Returns
1727684739535.png
 
Upvote 0
still looks like text and a different number
the date os a number from 1900 - so today is 45565
maybe post an xl2bb or share

Note: Images are difficult to see , and also requires that I input all the data myself, which means I may make an error, which is very time consuming, and from my point of view less likely to get a response, if a complicated spreadsheet. Plus we cannot see any of the formulas used.

Therefore -

A SMALL sample spreadsheet, around 10-20 rows, would help a lot here, with all sensitive data removed, and expected results mocked up and manually entered, with a few notes of explanation.

This will possibly enable a quicker and more accurate solution for you.

MrExcel has a tool called “XL2BB” that lets you post samples of your data and will allow us to copy/paste your sample data into our Excel spreadsheets, saving a lot of time.

You can also test to see if it works ok, in the "Test Here" forum.

OR if you cannot get XL2BB to work, or have restrictions on your PC

then put the sample spreadsheet onto a share

I only tend to goto OneDrive, Dropbox or google docs , as I'm never certain of other random share sites and possible virus.
Please make sure you have a representative data sample and also that the data has been desensitised, remember this site is open to anyone with internet access to see - so any sensitive / personal data should be removed

Make sure you set any share or google to share to everyone
 
Upvote 0
Test.xlsx
ABCD
1NameTypeRoleStart date
2Test Person APAYETest role 141519
3Test Person BPAYETest role 243346
4Test Person CPAYETest role 342401
5Test Person DContractorTest role 443346
6Test Person EContractorTest role 545264
7Test Person FSub-ContractorTest role 645104
Live Staff List
Cell Formulas
RangeFormula
A2:A7A2=SORT(UNIQUE(VSTACK(FILTER(PAYE!$AC$2:$AC$1048576,PAYE!$AC$2:$AC$1048576<>""), VSTACK(FILTER(Contract!$W$2:$W$1048576,Contract!$W$2:$W$1048576<>"")))))
B2:B7B2=XLOOKUP(A:A,PAYE!$AC:$AC,PAYE!$C:$C,"",0)&XLOOKUP(A:A,Contract!$W:$W,Contract!$C:$C,"",0)
C2:C7C2=XLOOKUP(A:A,PAYE!$AC:$AC,PAYE!$G:$G,"",0)&XLOOKUP(A:A,Contract!$W:$W,Contract!$G:$G,"",0)
D2:D7D2=XLOOKUP(A:A,PAYE!$AC:$AC,PAYE!$F:$F,"",0)&XLOOKUP(A:A,Contract!$W:$W,Contract!$F:$F,"",0)
Dynamic array formulas.


Test.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKAL
18 digit IDEE IDTypeForenameSurnameStart DateJob titleLine managerDOBContract typeLocationWorking DaysHours (including paid break)SexAddress 1Address 2Address 3Address 4CountyPostcodePersonal emailContact no. (work)Contact no. (personal)Emergency Contact NameEmergency Contact NumberCurrent basic salaryCar allowanceProbation PeriodFull nameFTE1 FTE SalaryLength of serviceAgeProbation review dateExtension monthsManager chased?StatusLeaver?
20000001010PAYETestPerson A02 September 2013Test role 1XXX08/11/1974Old540Male1 StreetVillageTownCountyPOST CDXXX@XXX.com3Test Person A1 11 Years, 0 Months & 28 Days4901 December 2013YPass
30000005454PAYETestPerson B03 September 2018Test role 2XXX05/04/1972Old540Male2 StreetVillageTownCountyPOST CDXX2@XXX.com3Test Person B1 6 Years, 0 Months & 27 Days5202 December 2018YPass
40000006363PAYETestPerson C01 February 2016Test role 3XXX24/09/1976Old540Male3 StreetVillageTownCountyPOST CDXX3@xxx.com3Test Person C1 8 Years, 7 Months & 29 Days4830 April 2016YPass
PAYE
Cell Formulas
RangeFormula
AC2:AC4AC2=IF(OR(ISBLANK(B2)), "", CONCATENATE(D2, " ", E2))
AD2:AD4AD2=IF(OR(ISBLANK(B2), ISBLANK(M2)), "", SUM(M2/40))
AE2:AE4AE2=IF(OR(ISBLANK(B2), ISBLANK(Z2)), "", SUM(Z2/AD2)*1)
AF2:AF4AF2=IFERROR(IF(OR(ISBLANK(D2),ISBLANK(F2)),"",DATEDIF(F2,TODAY(),"Y")&" Years, "&DATEDIF(F2,TODAY(),"YM")&" Months & "&DATEDIF(F2,TODAY(),"MD")&" Days"), "Not started")
AG2:AG4AG2=IF(OR(ISBLANK(I2)), "", DATEDIF(I2, TODAY(), "Y"))
AH2:AH4AH2=IF(OR(ISBLANK(B2), ISBLANK(AB2)), "", EDATE(F2,AB2+AI2)-1)
A2:A4A2=IF(OR(ISBLANK(B2)),"",REPT(0,8-LEN(B2))&B2)
C2:C4C2=IF(OR(ISBLANK(B2)), "", "PAYE")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B1:B4Cell ValueduplicatestextNO
AK1:AL4Cell Valuecontains "Pending"textNO
AK1:AL4Cell Valuecontains "Pass"textNO
AF1:AG4Cell Valuecontains "Not started"textNO
A1:B1Cell ValueduplicatestextNO


Test.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXY
18 digit IDEE IDTypeForenameSurnameStart dateService providedLine managerDOBLocationSupplier Competence Review PeriodAddress 1Address 2Address 3Address 4CountyPostcodeContact no. (Amaro)Contact no. (personal)Personal emailEmergency Contact NameEmergency Contact NumberFull nameLength of contracted serviceAge
200000C22C22ContractorTestPerson D03 September 2018Test role 4XXX34 StreetVillageTownCountyPOST CDTest Person D6 Years, 0 Months & 27 Days 
300000C31C31ContractorTestPerson E04 December 2023Test role 5XXX35 StreetVillageTownCountyPOST CDTest Person E0 Years, 9 Months & 26 Days 
4000000C3C3Sub-ContractorTestPerson F27 June 2023Test role 6XXX36 StreetVillageTownCountyPOST CDTest Person F1 Years, 3 Months & 3 Days 
Contract
Cell Formulas
RangeFormula
W2:W4W2=IF(OR(ISBLANK(D2), ISBLANK(E2)), "", CONCATENATE(D2, " ", E2))
X2:X4X2=IFERROR(IF(OR(ISBLANK(D2),ISBLANK(F2)),"",DATEDIF(F2,TODAY(),"Y")&" Years, "&DATEDIF(F2,TODAY(),"YM")&" Months & "&DATEDIF(F2,TODAY(),"MD")&" Days"), "Not started")
Y2:Y4Y2=IF(OR(ISBLANK(I2)), "", DATEDIF(I2, TODAY(), "Y"))
A2:A4A2=IF(OR(ISBLANK(B2)), "", REPT(0,8-LEN(B2))&B2)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
X1:Y2,W2,W3:Y4,K1:K4Cell Valuecontains "Not started"textNO
A1:B1Cell ValueduplicatestextNO
Cells with Data Validation
CellAllowCriteria
K2:K4List1,2,3,4,5,6
C2:C4ListContractor, Sub-Contractor, Agency
 
Upvote 0
????
you need to select the area of excel for XL2BB to use
 
Upvote 0
i think XL2BB has already converted the text numbers to values

but i'm not sure how they all link together
a simple sheet would help I think
or maybe add to a share
and then the text format may retain

I suspect on the test.xls - its column D

which uses a concatenate
=XLOOKUP(A:A,PAYE!$AC:$AC,PAYE!$F:$F,"",0)&XLOOKUP(A:A,Contract!$W:$W,Contract!$F:$F,"",0)
which may result in text and NOT a date
 
Upvote 1
Solution
i think XL2BB has already converted the text numbers to values

but i'm not sure how they all link together
a simple sheet would help I think
or maybe add to a share
and then the text format may retain

I suspect on the test.xls - its column D

which uses a concatenate
=XLOOKUP(A:A,PAYE!$AC:$AC,PAYE!$F:$F,"",0)&XLOOKUP(A:A,Contract!$W:$W,Contract!$F:$F,"",0)
which may result in text and NOT a date
It looks like you're right and because of the concatenation, it returns as text

I've fixed this by using the following instead
Excel Formula:
=IF(B2="PAYE", XLOOKUP(@A:A, PAYE!AC:AC, PAYE!F:F, "", 0), IF(B2="Contractor", XLOOKUP(@A:A, Contract!W:W, Contract!F:F, "", 0), IF(B2="Sub-Contractor", XLOOKUP(@A:A, Contract!W:W, Contract!F:F, "", 0))))

Thank you
 
Upvote 0
you are welcome, glad to have pointed you in the right direction

As i mentioned you can turn TEXT numbers back to real numbers by using
*1
or +0
or i think
-- also will do that at the start of the formula
in the formula or at the end

but as you have fixed it, aqll sorted
 
Upvote 0

Forum statistics

Threads
1,224,811
Messages
6,181,082
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top