Populate column A based on data in Column B

monkeyharris

Active Member
Joined
Jan 20, 2008
Messages
372
Office Version
  1. 365
Platform
  1. Windows
I wasn't sure what the title should be so please bear with me. I have a system generated report which i need to change in Excel to something useful, but can't find how to do it.

When the report is first opened, the only data shown is what's in B to I. I add column A to manually get what i need.

As you can see, every job un the account column shows the users sales. I added column a and put the users code and the account code they sold products to. Is there a way of automating this? It will always be the same format and users range from 1 to 30. 1=KUL, 2=RAM, 6=Kev etc etc.

I just need to make a report that sums every line by user and can't think of another way to do it.

Test1.xlsx
ABCDEFGHI
1UserAccountNameInvoiceInvoice DateInvoice TotalPayment AmountCurrency CodeRate
22 - Kul
32-CASHSALECASHSALECASH SALE51133710/12/20243,380.843,380.84STG1.00
42-PLANPLANP & S51061202/12/2024159.52159.52STG1.00
52-PLANPLANP & S51081104/12/2024281.81268.47STG1.00
62-SINGSINGS & I51110406/12/2024105.600.00STG1.00
73 - Ram
83-C.O.DC.O.DCASH ON DELIVERY (C.O.D.)51071603/12/20241,878.840.00STG1.00
93-RAMJOHALRAMJOHALRAM51094305/12/202423.040.00STG1.00
106 - Kev
116-ANRSANRSANDREW C51204818/12/2024306.000.00STG1.00
126-C.O.DC.O.DCASH ON DELIVERY (C.O.D.)51143411/12/202422.7922.79STG1.00
136-CASHSALECASHSALECASH SALE51061702/12/202486.9486.94STG1.00
146-CASHSALECASHSALECASH SALE51131210/12/202478.0078.00STG1.00
156-CASHSALECASHSALECASH SALE51131410/12/202416.0116.01STG1.00
166-CASHSALECASHSALECASH SALE51204218/12/2024273.60273.60STG1.00
176-CASHSALECASHSALECASH SALE51204618/12/202441.9441.94STG1.00
186-CASHSALECASHSALECASH SALE51205518/12/202434.7834.78STG1.00
196-CASHSALECASHSALECASH SALE51206218/12/202457.6057.60STG1.00
206-CASHSALECASHSALECASH SALE51211219/12/202411.7611.76STG1.00
216-CASHSALECASHSALECASH SALE51211719/12/202479.1679.16STG1.00
226-CASHSALECASHSALECASH SALEC51204518/12/2024-41.94-41.94STG1.00
236-CCR029CCR029CRISTEL51087304/12/2024273.600.00STG1.00
246-CCR113CCR113TANTON C51205118/12/202414.390.00STG1.00
256-CCR122CCR122COLYER B51067203/12/2024121.64121.64STG1.00
266-CCR122CCR122COLYER B51072503/12/202449.9249.92STG1.00
276-CCR122CCR122COLYER B51101506/12/202431.1831.18STG1.00
286-CCR122CCR122COLYER BC51072403/12/2024-34.32-34.32STG1.00
296-CCR122CCR122COLYER BC51101406/12/2024-25.20-25.20STG1.00
306-HACOHACOHATTON51124309/12/20242,388.970.00STG1.00
316-HACOHACOHATTON51199518/12/2024173.400.00STG1.00
326-RAMJOHALRAMJOHALRAM51210419/12/202416.730.00STG1.00
336-RSTDRSTDRSP BUILDC51075103/12/2024-46.200.00STG1.00
346-RSTDRSTDRSP BUILDC51075203/12/2024-13.200.00STG1.00
Sheet1
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Hello, please test the following if it fits the purpose or not:

Excel Formula:
=LET(
r,B2:B34,
b,--(IF(ISNUMBER(SEARCH("? - ",r)),TEXTBEFORE(r," - ",1))),
c,SCAN("",b,LAMBDA(x,y,IF(y<>0,y,x+y))),
IF(b=0,c&"-"&r,""))
 
Upvote 0
Solution
Hello, please test the following if it fits the purpose or not:

Excel Formula:
=LET(
r,B2:B34,
b,--(IF(ISNUMBER(SEARCH("? - ",r)),TEXTBEFORE(r," - ",1))),
c,SCAN("",b,LAMBDA(x,y,IF(y<>0,y,x+y))),
IF(b=0,c&"-"&r,""))
Hi Hagia,
That's amazing. Now i just need to go over and over it so i understood what you've just done :)
 
Upvote 0
Many thanks for the feedback. It might even be shortened to:

Excel Formula:
=LET(
r,B2:B34,
b,--(TEXTBEFORE(r," - ",1,,,0)),
c,SCAN("",b,LAMBDA(x,y,IF(y<>0,y,x+y))),
IF(b=0,c&"-"&r,""))
 
Upvote 0

Forum statistics

Threads
1,224,821
Messages
6,181,163
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