Suggested formula?

IanBr

New Member
Joined
Sep 17, 2018
Messages
15
Office Version
  1. 365
Me again,

I have a table along the lines of:
a
1123
b134
c1235423
d12435
a2214
b32354
b22352

<tbody>
</tbody>

Where first column is an account number, the second is the sequence of the sale and the 3rd is the value of the sale. What I want to do is to have a formula in the 4th column along the lines of "if this is not the first sale, what was the value of the first sale"

So for example the returned value against the 5th line would be 123 (line 5 is the second sale to a and the first sale was for 123)

Any ideas?

I got as far as =if(a5>1,vlookup(a5,a1:c7,3,0),"nil") however this wouldn't necessarily pick up the first sale to "a" so there needs to be some sort of search to find the row where column a is a and column b is 1 and return value from column c of this row
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Try:

ABCDEF
1a1123
2b134
3c1235423
4d12435
5a2214123
6b3235434
7b2235234

<tbody>
</tbody>
Sheet8

Worksheet Formulas
CellFormula
E1=IF(B1=1,"",SUMIFS($C$1:$C$10,$A$1:$A$10,A1,$B$1:$B$10,1))

<tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0
How about
=IF(B1=1,"nil",SUMPRODUCT((A$1:A$7=A1)*(B$1:B$7=1),(C$1:C$7)))
 
Upvote 0
Thank you both.

Both of the above work!

Next step... can it be adapted so that it only returns values for each customer on one line so for example in Eric W's solution shown above, lines 6 and 7 return the answer 34 (correctly). Ideally I only want to see first spend value against the most recent sale (i.e in the above row 6 would return 34, line 7 would return blank)

Thanks again
 
Upvote 0
How about
=IF(OR(B1=1,COUNTIF(A$1:A$7,A1)<>B1),"",SUMPRODUCT((A$1:A$7=A1)*(B$1:B$7=1),(C$1:C$7)))
 
Upvote 0
Or:

=IF(COUNTIF($A$1:$A1,A1)<>2,"",SUMIFS($C$1:$C$10,$A$1:$A$10,A1,$B$1:$B$10,1))
 
Upvote 0

Forum statistics

Threads
1,215,143
Messages
6,123,277
Members
449,093
Latest member
Vincent Khandagale

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